.Visible = False not working...

R

Rob R. Ainscough

I can't seem to make my form not visible. During the Load event I
specifically set Me.Visible = False but the form still displays?

Any suggestions ?
 
H

Herfried K. Wagner [MVP]

Rob R. Ainscough said:
I can't seem to make my form not visible. During the Load event I
specifically set Me.Visible = False but the form still displays?

It's too late at this point. The 'Load' event is called directly prior to
making the form visible, regardless of the value of the 'Visible' property.
Don't call the form's 'Show'/'ShowDialog' method in order to prevent it from
getting visible.
 
R

Rob R. Ainscough

Can't use that setting as the project is started from Sub Main.

Example:

Module MyStartup

Sub Main()

Dim myForm as New Form1

' Do some pre-processing...(code not shown)

Application.EnableVisualStyels()
Application.Run(myForm)

End Sub

End Module
 
H

Herfried K. Wagner [MVP]

Rob R. Ainscough said:
How about using the Activated event to set Visible ?

I suggest to describe the scenario in more detail. Maybe there is even a
better solution, for example, performing the tests on instantiaton instead
of performing it when the form is intended to get visible.
 
R

Rob R. Ainscough

I could, but I'd have to change a lot of code, not sure I want to do that.
The Activated event is working well enough.

Thanks, Rob.
 

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