Date verification

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Date verification

 
0
  #1
Jan 21st, 2008
I am having a problem validating a date entered by user. This date must be later than todays date(at input time). I have attempted using the > (today) but this will not work if the the month is larger then input time. If you have any examples I would greatly appreciate it.
Example of what i have tried:
  1. if userdate < FormatDateTime(Today) then
  2. lblerrormessage.visible = True
Last edited by ProfessorPC; Jan 21st, 2008 at 3:51 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: Date verification

 
1
  #2
Jan 21st, 2008
Try this:
  1. Dim d As DateTime = CDate(TextBox1.Text)
  2. If (DateTime.Compare(Now, d) > 0) Then
  3. MessageBox.Show("Entered date has already happened. Please enter a future date.")
  4. End If
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: Date verification

 
0
  #3
Jan 21st, 2008
That did it.
Thank you
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1484 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC