Problem in validation DataTime Picker in c#
Hello every one,
well i have big problem i want to make validation in control . i have one date time picker.. validation is that date should not be less than todays date..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Dec 16, 2009, 2:22 AM
You can use datetimepicker's Closeup event to do that.
private void dateTimePicker1_CloseUp(object sender, EventArgs e)
{
if (dateTimePicker1.Value < DateTime.Today)
{
MessageBox.Show("Date cannot be less than today!");
dateTimePicker1.Value = DateTime.Today;
}
}
Hiren SoniPosted Dec 16, 2009, 8:22 AM
you can set this line on page load . So from this you cant even select date less than today date.
Srinivas KotraPosted Dec 16, 2009, 7:39 AM