private void dtto_Validating(object sender, CancelEventArgs e)
{
try
{
if (dtfrom.Value > dtto.Value)
{
MessageBox.Show(" 'To' date must be greater than or equal to 'From' date", "To", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dtto.Text = "";
dtto.Focus();
return;
}
}
catch (Exception)
{}
}
private void dtfrom_Validating(object sender, CancelEventArgs e)
{
try
{
if (dtfrom.Value > dtto.Value)
{
MessageBox.Show(" 'From' date must be less than or equal to 'From' date", "From", MessageBoxButtons.OK, MessageBoxIcon.Warning);
dtfrom.Text = "";
dtfrom.Focus();
return;
}
}
catch (Exception)
{}
}Validating 'From' and 'To' dates(when selecting 'To' date it must be greater than 'From 'date and 'From' date must be less than 'To'
