check valid date in format YYYY/MM/DD was entered: currently i user cdate(mystring) and if exception, then i prompt user
Posted on 2004-10-19
hi, i have a form where the user has to enter date in format : YYYY/MM/DD
how this is the only way i know of for me to validate if a valid date was entered.
but it is horrible and wrong.
is there a better way to check if a valid user date was entered?
i cant get working regular expression for .net for a valid date.
i use vb.net , but posted this is .net section if there is possible a generic solution.
GetMyDateInput = MyForm.TextBox1.Text
Dim strCheck As Object = CDate(GetMyDateInput)
Catch ex As Exception
MessageBox.Show("Cannot Convert " & GetMyDateInput & " to Date")