For everything that is related to parsing a string to a value (integers, reals, dates, etc...), you should always use the
TryParse
method of the target valuetype.
In your example, that would be:
Dim myDate As DateTime
If (DateTime.TryParse(TextBox2.Text, myDate))
Else
End If
The
TryParseExact
method gives you even more control on the input format.
DateTime.TryParse Method[
^]
DateTime.TryParseExact Method[
^]