|
-
Jan 27th, 2007, 09:00 AM
#1
Thread Starter
Member
If not IsDate(txtMyDate.Text) not working
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.
-
Jan 27th, 2007, 09:40 AM
#2
Frenzied Member
Re: If not IsDate(txtMyDate.Text) not working
reddymade1:
Did you declare txtMyDate as date?
Dim txtMyDate As Date
-
Jan 27th, 2007, 10:52 AM
#3
Hyperactive Member
Re: If not IsDate(txtMyDate.Text) not working
 Originally Posted by AIS4U
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.
God put me on this earth to do many great things, and I'm so far behind that I'm going to live forever.
I'm programming for Windows using a Apple Mac Mini, 1.5Ghz with 512MB DDR RAM. I feel like I'm committing a crime :P
-
Jan 27th, 2007, 10:58 AM
#4
Re: If not IsDate(txtMyDate.Text) not working
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|