Quote:
quote:Originally posted by jijish
I have a textbox such that when the user enters the value in the textbox it should check whether the value entered is valid date or not.How to use the validation controls.
|
For you application, what is a "valid" date? For example in my applications a valid date is MM/DD/YYYY but some countries use the DD/MM/YYYY format so on and so on and so on.
Couple of things you can do, you can use the DateTime method TryParse() which returns a bool if the specified string can be parsed into a Valid date time. The only thing this will tell you, of course, is if the string is a valid date time.
You can also write a regular expression to check for a speicfic Date format such as MM/DD/YYYY.
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========