| Business Application Development with: SQL Server, C#, VB, VB.Net, ASP, ASP.Net, and XML |
|
|
News Links Schedule Site Map Contact |
|
Tips and Tricks for: VB.Net, C#, .Net, WinForms, Windows XP
The Problem: SEHException in System.Windows.Forms.UnsafeNamtiveMethods.DispatchMessageWThis usually shows up several levels in the stack below the Application.Run(myForm) call. Solution: Add a Application.DoEvents right after EnableVisualStyles or remove any use of Application.EnableVisualStyles.Application.EnableVisualStyles is used to turn on Windows XP theme support in some of the WinForms controls. However, once I turned it on, this exception started being raised. Removing the call to Application.EnableVisualStyles removed the problem. I'll can live without theme support. However, it appears that if there is a Application.DoEvents right after the Application.EnableVisualStyles, the exception doesn't get raised. Go figure? So your code should read. Application.EnableVisualStyles ' Now go and set the FlatStyle to system.... I found confirmation of this in some newsgroup postings and at a Microsoft Developer Days presenation.
|
|
|
Copyright © 2003-2008 Novick Software, Inc. | Terms of Use | Privacy Policy | Nice Things People Say| |