Application.EnableVisualStyles() and Splah Screen

S

Skysurfer

Hi.

I made a simple VB.Net 2003 application in which i have one Module with the
Sub Main and two forms with un button in each one.
I run the application on Windows XP Professional.

This is the code in Module1:

Module Module1
Sub Main()
Application.EnableVisualStyles()
Dim frm1 As New Form1
frm1.ShowDialog()
Application.Run(New Form2)
End Sub
End Module

The first problem is that the button on Form1 isn't XP Style, even if the
FlatStyle property is System.
When i press the button on Form1 the form is closed and Form2 appears, but
also in this form the button is not XP style.

But, if i don't show Form1, removing frm1.ShowDialog, the button on Form2 is
ok with XP Style.

In my real application Form1 will be a Spash Screen and before opening Form2
there will be some code.

What's wrong?

Thanks.

Grazie.
Ciao
 
M

Mick Doherty

Module Module1
Sub Main()
Application.EnableVisualStyles()
Application.DoEvents() '<-----------
Dim frm1 As New Form1
frm1.ShowDialog()
Application.Run(New Form2)
End Sub
End Module
 
H

Herfried K. Wagner [MVP]

Skysurfer said:
I made a simple VB.Net 2003 application in which i have one Module with
the
Sub Main and two forms with un button in each one.
I run the application on Windows XP Professional.

This is the code in Module1:

Module Module1
Sub Main()
Application.EnableVisualStyles()
\\\
Application.DoEvents()
///

Dim frm1 As New Form1
frm1.ShowDialog()
\\\
frm1.Dispose()
///

Application.Run(New Form2)
End Sub
End Module

The first problem is that the button on Form1 isn't XP Style, even if the
FlatStyle property is System.

'Application.EnableVisualStyles' Bug
<URL:http://www.codeproject.com/buglist/EnableVisualStylesBug.asp>
 
S

Skysurfer

"Mick Doherty"
Module Module1
Sub Main()
Application.EnableVisualStyles()
Application.DoEvents() '<-----------
Dim frm1 As New Form1
frm1.ShowDialog()
Application.Run(New Form2)
End Sub
End Module


Thank you very much, Mick!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top