I am having a problem validating a date entered by user. This date must be later than todays date(at input time). I have attempted using the > (today) but this will not work if the the month is larger then input time. If you have any examples I would greatly appreciate it.
Example of what i have tried:

if userdate < FormatDateTime(Today) then
lblerrormessage.visible = True

Recommended Answers

All 2 Replies

Try this:

Dim d As DateTime = CDate(TextBox1.Text)
        If (DateTime.Compare(Now, d) > 0) Then
            MessageBox.Show("Entered date has already happened. Please enter a future date.")
        End If

That did it.
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.