Click here to Skip to main content
14,828,654 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello folks!!

I have a maskedtextbox named txtdob in which i want to validate user to enter date in dd/mm/yyyy format for that i put the following code:

txtdob.ValidatingType = typeof(System.DateTime);


but my system date is set in mm/dd/yyyy format. How can i check the user input i.e date in my desired format in the txtdob.

Thanks..

[Edit] inserting code block [/Edit]
Posted
Updated 1-May-11 21:46pm
v2

1 solution

Hi udaysama,

I think you have to change it in your windows time settings:

start -> Control panel -> region and language -> formats tab -> additional settings button ->date tab

then edit your short date format.

I hope this help,
Good Luck,
:)
   
Comments
Uday P.Singh 2-May-11 4:08am
   
I don't want to change it in my windows time settings, because we don't know which settings are being used by our end users so i want to do it from my winform itself
Michael Waguih 2-May-11 4:13am
   
So it will depend on the user date format defined on his windows.
Uday P.Singh 2-May-11 4:20am
   
is there any way to check it through our winform??
Michael Waguih 2-May-11 4:27am
   
try to do it manually like :
DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900