deployment problem with xp visualstyles

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have an application written in vb.net which compiles and builds ok except when I put in the following 3 lines to enable xp style visualstyles

<STAThread()> Public Shared Sub Main()
Windows.Forms.Application.EnableVisualStyles()
Windows.Forms.Application.DoEvents() Windows.Forms.Application.Run(New MdiClient)

End Sub

I now get the following error on machines without visual studio installed but with xp

Application has generated an exception that could not be handled.
process id = 0x290 (656), Thread id = 0x840 (2112)
I build my application exactly the same except with the above lines in and I get the following error message

What do I need on these machines to get the working. All users have the .net framework 1.1 installed. Any ideas would be appreciated.

thank you
Geri
 
* "=?Utf-8?B?R2VyYWxkaW5lIEhvYmxleQ==?= said:
I have an application written in vb.net which compiles and builds ok except when I put in the following 3 lines to enable xp style visualstyles

<STAThread()> Public Shared Sub Main()
Windows.Forms.Application.EnableVisualStyles()
Windows.Forms.Application.DoEvents() Windows.Forms.Application.Run(New MdiClient)

End Sub

I now get the following error on machines without visual studio installed but with xp

Application has generated an exception that could not be handled.
process id = 0x290 (656), Thread id = 0x840 (2112)
I build my application exactly the same except with the above lines in and I get the following error message

What Windows version are you trying to run the application on?
 
Hi Herfried,
I'm trying to run the application on windows 98.
..net applications should be able to run on windows 98 and above
 
Try this:

\\\
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
Application.EnableVisualStyles()
Application.DoEvents()
End If
Application.Run(...)
///
 
After reading this & other threads, this is what I have come up with:

\\\
<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes)Then
System.Windows.Forms.Application.EnableVisualStyles()
End If
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main
///

I put this code directly underneath the "inherits" section of the Form1
Class. Another thing I found was that you need to set the "FlatStyle"
property on all your controls to "System", otherwise it won't work.

I haven't tried it on anything other than WindowsXP & Server 2003.
 
Back
Top