I have the following condition:
But the date string is in this format "dd/MM/yyyy"
If not IsDate(txtMyDate.Text) then
I am getting an error message date is in wrong tstring format.
Thank you very much foir the information.
Printable View
I have the following condition:
But the date string is in this format "dd/MM/yyyy"
If not IsDate(txtMyDate.Text) then
I am getting an error message date is in wrong tstring format.
Thank you very much foir the information.
reddymade1:
Did you declare txtMyDate as date?
Dim txtMyDate As Date
It's a textbox, not a variable. If he was declaring it as a date variable, it would be logical to assume that it indeed WAS a date, and therefore he probably wouldn't need to be checking it.Quote:
Originally Posted by AIS4U
What you need is to use the TryParse method of the Date class.
VB Code:
Dim theDate As Date If Date.TryParse(txtMyDate.Text, theDate) Then 'This is a date Else 'The text is not in any date format End If