Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Mask for DateTime field in PropertyGrid
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Mask for DateTime field in PropertyGrid

 Post Reply Post Reply
Author
Message
p4kumar View Drop Down
Newbie
Newbie


Joined: 06 February 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote p4kumar Quote  Post ReplyReply Direct Link To This Post Topic: Mask for DateTime field in PropertyGrid
    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.
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 15 February 2009 at 6:06am
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....
Back to Top
p4kumar View Drop Down
Newbie
Newbie


Joined: 06 February 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote p4kumar Quote  Post ReplyReply Direct Link To This Post Posted: 19 February 2009 at 11:17pm
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.