943,915 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1141
  • C++ RSS
Oct 27th, 2008
1

Validating DateTimePicker

Expand Post »
I need to make sure that when the user select a date from a DateTimePicker the date should not be less than Today's date,

anyone knows how to achieve that

Thanx
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Oct 27th, 2008
0

Re: Validating DateTimePicker

On change event, in datatime picker, compere date with Now().CurrentDate();
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Validating DateTimePicker

Im not sure if Im doing it right but... I have changed the datetimepicker to ValueChanged so now I dont have compare option to compare the datetimepicker with Now().CurrentDate()

PLease let me know if u have an idea
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Oct 27th, 2008
0

Re: Validating DateTimePicker

not shure exacly what did you do with the data picked in datatimepicker, but still you suposed to have the picked data samwhere, theather way what is the poitn of using the picker..
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Validating DateTimePicker

I have a datetime picker, then I have ValueChanged event handler for it and a code that goes like this

DateTime date = DateTime::Parse(dtpDate->Text);
System::DateTime::Compare(date, System::DateTime::Today.Now);

but now its trhowing exception that said date is not valid I cant even open my form
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Oct 27th, 2008
0

Re: Validating DateTimePicker

what is tis line suposed to asign to varible date ?
C++ Syntax (Toggle Plain Text)
  1. DateTime date = DateTime::Parse(dtpDate->Text);

why do you try to compere it in this way ?
try instad
C++ Syntax (Toggle Plain Text)
  1. if (Now().CurrentDate()<DateTimePicker1->Date)
  2. {
  3. //your code
  4. }
in onchange event
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008

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 C++ Forum Timeline: Soap and problem with timeout
Next Thread in C++ Forum Timeline: Urgent Request on Printing





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


Follow us on Twitter


© 2011 DaniWeb® LLC