Reputation: 9
I have a windows application and i have a validation to check date time picker control to does not select greater to its maximum value and show a message that "You can't select".
I have validate and showing message in ValueChanged event and its working fine in windows 7 environment, but when i run this application in windows server 2003 the date values changes and the message box showing repeatedly for infinite times.
So please suggest any better idea to validate date change to run it in both windows 7 and windows server 2003.
My Code
In load event
public void LoadHistoricData()
{
// Set its maximum value.
}
private void dtpHInputDate_ValueChanged(object sender, EventArgs e)
{
MessageBox.Show("You can't select greater than maximum date");
}
also i have used,
private void dtpHInputDate_CloseUp(object sender, EventArgs e)
{
MessageBox.Show("You can't select greater than maximum date");
}
Thanks.
Upvotes: 1
Views: 319
Reputation: 2163
Alternatively you could use jquery
in displaying date calendar.and there you can disable the future dates.so you will not need to add any extra validation for selecting future date.
Upvotes: 1