I have two DateTimePickers on my form as well as some other controls. On the
ValueChanged events for the two DateTimePickers I have code to check if there
are unsaved changes on the form, and if so, prompt the user to save. The
problem is, if the user has clicked on one of the month change buttons (< or
>) on the DateTimePicker, if the messagebox pops up, the month change button
gets stuck down and keeps changing the date until you move the focus out of
the control. I tried programmatically moving the focus either before or
after I show the Messagebox, but it seems to have no effect.
Does anyone know how I can get around this?
Does anyone know if this is a known issue?
Thanks,
Brian Haynes
Maqsood Ahmed - 23 Feb 2005 08:37 GMT
Hello,
You can do one thing, show MessageBox using BeginInvoke. See the
following code snippet.
In ValueChanged Event:
this.BeginInvoke(new MethodInvoker(ShowMessageBox));
Now define another method:
private void ShowMessageBox()
{
MessageBox.Show("This is a message");
}
Cheers :)
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net