943,600 Members | Top Members by Rank

Ad:
Jun 29th, 2009
0

How to check a valid date...

Expand Post »
Hi everyone!
I have a problem related with dates.... i have some textbox where i put dates to send to a database... i have conditioned the input just for numbers and / (backslash), but how do i check that no one inserts a format that's not dd/mm/yyyy... if i put 1234 sends an error and stops

Thanks everyone!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fernando82 is offline Offline
5 posts
since Jun 2009
Jun 29th, 2009
0

Re: How to check a valid date...

You have to parse each field and check to see if its legitimate.
Also check the day number to number of days in that month.
And double check if its a leap year or not.
You could parse and convert to Julian and store as a 32-bit number.
You may want to consider allowing dwarf entries so that for example today is 6/29/2009 but if someone enter 7/11 it will exchange 7/11 for 7/11/2009 automatically or with a verify! It gets very old having to enter a complete date every time!
You may consider a date split - six months vs + six months so that for example entry of past invoices allows a dwarf date!
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Jun 29th, 2009
0

Re: How to check a valid date...

IsDate anybody???

Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jun 30th, 2009
0

Re: How to check a valid date...

Thanks to both of you!

The IsDate solution works perfectly... of course i'll check the other options, thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fernando82 is offline Offline
5 posts
since Jun 2009
Jul 3rd, 2009
0

Re: How to check a valid date...

Add MS Mask Edit control in your form and under its Property go to
mask and enter ##/##/#### then
run the programme and give focus. you can enter your own date without using dtpicker.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
kehar is offline Offline
72 posts
since Sep 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: AutoClicker
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Have a question....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC