Comparing dates entered from a form

  • Thread starter Thread starter hansiman
  • Start date Start date
H

hansiman

In a form a user enteres two dates (from and to) in format dd-mm-yyyy.

How do I check if to >= from.

All the different attempts end up in "String was not recognized as a
valid DateTime" when I try to convert "24-12-2002"

Dim dateFrom As DateTime = Convert.ToDateTime(txtFrom.Text)
Dim dateTo As DateTime = Convert.ToDateTime(txtTo.Text)

I'd like not to have to manually break up the entered string into its
day, month and year parts - day = left(txtTo.Text, 2) only to
re-assemble and then compare.

Any suggestions?

/Morten
 
Back
Top