Mask for DateTime field in PropertyGrid |
Post Reply |
Author | |
p4kumar
Newbie Joined: 06 February 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 06 February 2009 at 11:11am |
All,
How can I create a mask to the DateTime field in the propertygrid such a way that, user can enter only in that format. For example, by default "dd/mm/yyyy" should be displayed in the DateTime field. When user key in numbers, the numbers should replace the respective palces in the field. Ofcourse, user can give input from DateTime picker also. Please, suggest me by giving code snippets or sample source code. Thanks in advance. |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
Here's is code from samples
Dim DateItem As PropertyGridItemDate
'Adds a date item with an initial date of 14/02/2009 Set DateItem = Category.AddChildItem(PropertyItemDate, "DateItem", "14/02/2009") 'Sets date format to MM/DD/YYYY DateItem.Format = "%d/%m/%Y" 'Returns the currently set date formated with the mask MM/DD/YYYY Debug.Print "Currently set date (DD/MM/YYYY): " & DateItem.Value 'Returns the currently set date without a format mask Debug.Print "Unformated date (DDMMYYYY): " & DateItem.MaskedText 'Changes Day to the 13th
DateItem.Day = 13 'Changes Month to February DateItem.Month = 2 'Changes the Year to 2009 DateItem.Year = 2009 |
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
p4kumar
Newbie Joined: 06 February 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi Aaron,
Thank you very much for your reply. But, Im working on C#, .NET and it is little bit difficult to understand as I have used Visual Basics long back. Can you please explain this in C# and .NET? It would be greatful if you share any source code with me. Thank you. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |