Vb.NET - IsDate() to check for valid date input validation



Function to check the given date is valid

Sub CheckDate()
        Dim txtDate As Date = "Dec 26,2009"
      'can pass txtdate as value in the textbox 
        If IsDate(txtDate) Then
           'returns true if valid date
            MessageBox.Show("Valid Date")
        Else
            'returns false in case of invalid date
            MessageBox.Show("Not a Valid Date")
        End If
    End Sub

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.