1

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

2
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by uim_1977
0

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

0

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..

0

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

0

what is tis line suposed to asign to varible date ?

DateTime date = DateTime::Parse(dtpDate->Text);

why do you try to compere it in this way ?
try instad

if (Now().CurrentDate()<DateTimePicker1->Date) 
{
//your code
}

in onchange event

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.