You receive an "unhandled exception of type 'System.Runtime.InteropServices.SEHException'" error message when you call the Application.EnableVisualStyles method in Visual Basic 2005 or in Visual Basic .NET (897298)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
SYMPTOMSIn Microsoft Visual Basic 2005 and in Microsoft Visual Basic .NET, when you call the Application.EnableVisualStyles method from the Form_Load event or from any other event, you receive an error message that is similar to the following: An unhandled exception of type 'System.Runtime.InteropServices.SEHException'
occurred in system.windows.forms.dll
Note This issue occurs when the following conditions are true: - The event calls the Application.EnableVisualStyles method again.
- The event calls the Application.EnableVisualStyles method when a form loads or after a form loads.
WORKAROUNDTo work around this issue, use one of the following methods: MORE INFORMATIONYou may receive the same error message that is discussed in the "Symptoms" section when you use the ShowDialog method to open a form. To work around this behavior, use the Show method instead of the ShowDialog method.
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005applies kbprb KB897298 kbAudDeveloper |
---|
|