Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

I was getting a nasty error today. I built a tabcontrol component and docked (fill) it on a form with a statusbar. Whenever I moved my mouse from the component to the statusbar, I got this exception:

Class:System.Runtime.InteropServices.SEHException
Message: External component has thrown an exception.

The exception occurred in the method that called Application.Run, and it would end the application after the exception was handled. After some googling, I learned that it was because I did not call Application.DoEvents after Application.EnableVisualStyles. I have never read that before, so hopefully this helps somebody.
So now my code reads:

Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New frmMain)

Here are some more links about it:
http://www.codeguru.com/forum/showthread.php?p=1036531
http://www.mctainsh.com/Csharp/EnableVisualStylesIsEvil.aspx

Posted on Thursday, March 24, 2005 2:07 PM | Back to top


Comments on this post: Application.DoEvents - SEHException

# re: Application.DoEvents - SEHException
Requesting Gravatar...
Many thanks, this has helped me save some time on our app
Left by Steve Nixey on Jul 07, 2005 3:30 AM

# re: Application.DoEvents - SEHException
Requesting Gravatar...
Left by LED downlights on Jul 16, 2011 1:34 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net