Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2005

Tip: Looking for answers? Try searching our database.

DateTimePicker gets stuck when msg shown during ValueChanged event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Haynes - 22 Feb 2005 18:23 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.