validation and error message..

Ecah

New member
Joined
Jul 26, 2012
Messages
1
Location
kuala lumpur
Programming Experience
Beginner
hi..can anyone tell me how do we validate date?
if the date format is not yyyyMMdd, error message "Invalid Date Format"
 
Assuming you're talking about the user entering the data via a form then you should use a DateTimePicker and it will handle all that for you. If you're talking about any old String then you can use the Date.TryParseExact method, which will return True or False if the data passes or fails and, if it passes, will also output the Date value.
 
Back
Top