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..
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 15, 2009, 9:22 PM EST
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;
}
}
Srinivas KotraRank #8,059 · 229 reputationPosted Dec 16, 2009, 2:39 AM EST
Hiren SoniRank #694 · 3.5K reputationPosted Dec 16, 2009, 3:22 AM EST
you can set this line on page load . So from this you cant even select date less than today date.