hi there,
i have asked this question several times but i coudn't solve this problem.
i have two datetime picker one as the start date and the othere as the end date. when the user clicks a date in the start date he should not select a date that has passed. but when I try to select a passed date in a previous date the error msg appear several times. why is this happening.
i have coded in the closeup and the value change event
how can i solve this.
thanxx
private void dpSdate_CloseUp(object sender, EventArgs e)
{
if (dpSdate.Value < System.DateTime.Now.Date)
{
dpSdate.Validating -= new CancelEventHandler(dpSdate_ValueChanged);
dpSdate.Text = System.DateTime.Now.Date.ToString();
dpSdate.Validating += new CancelEventHandler(dpSdate_ValueChanged);
}
}
private void dpEdate_ValueChanged(object sender, EventArgs e)
{
if (dpEdate.Value < dpSdate.Value)
{
dpEndDateC++;
if (dpEndDateC == 2)
MessageBox.Show("Enter date greater than start date");
}
}