One of the easiest way of validating the date is to assign the date to a date type variable, if it throws an exception then it is not in proper format.
Private Sub CheckDate(ByVal d As String, ByVal m As String, ByVal y As String) Try Dim mydate As Date mydate = New DateTime(y, m, d) Catch obj As Exception MessageBox.Show ( obj.Message ) End Try End Sub
Now call this function
CheckDate("2", "12", "2004")
|
| Author: Asad Naeem 03 Jul 2004 | Member Level: Bronze Points : 0 |
Very simple code to help beginners for the validation of date.
|
| Author: Ashokselva 31 Aug 2004 | Member Level: Bronze Points : 0 |
sir i copied this same code and work it out in vb.net.but there is no change at all .i dont know what happened?
|
| Author: Ashokselva 31 Aug 2004 | Member Level: Bronze Points : 0 |
sir i copied this same code and work it out in vb.net.but there is no change at all .i dont know what happened?
|