943,822 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 2047
  • VB.NET RSS
Jan 21st, 2008
0

Date verification

Expand Post »
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:
VB.NET Syntax (Toggle Plain Text)
  1. if userdate < FormatDateTime(Today) then
  2. lblerrormessage.visible = True
Last edited by ProfessorPC; Jan 21st, 2008 at 3:51 am.
Similar Threads
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 2007
Jan 21st, 2008
1

Re: Date verification

Try this:
VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Jan 21st, 2008
0

Re: Date verification

That did it.
Thank you
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 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 VB.NET Forum Timeline: Using custom DLL in vb.net application
Next Thread in VB.NET Forum Timeline: Add tabpages and controls to them dynamically.





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


Follow us on Twitter


© 2011 DaniWeb® LLC