Unable to hide form? in .NET 2.0


Rob R. Ainscough

Any suggestions on how to make a form not visible when displayed via
Form1.ShowDialog() ?

If I put a button on the form called "Close" and in the click event I put
Me.visible = false, the form closes and my application terminates. I don't
want this, I just want it to hide (Me.Hide is the same as Me.visible).

I'm using a module1.vb with a sub Main() from the sub Main I Dim Form1 as
New myForm and then call the Form1.ShowDialog.

I can't find any way to hide a Form that is initially displayed (Modal) via
ShowDialog which closing the form. Is this just not possible in .NET 2.0


Jim Wooley

If you hide a modal dialog, you can't do anything until you re-show it and
close it. By definition, a modal dialog must be the topmost form in your
application and takes control of the application until it is closed. I suspect
you would be better off using Form.Show(). Another alternative would be using
the following in your Sub Main:

Sub Main
dim Form1 as new myForm
End Sub

Jim Wooley

Rob R. Ainscough

thanks, yes I ended up using Applicaiton.Run(myForm) and it works well.

I am also overriding WndProc and I need to determine what message is sent
when an the application is being unistalled via (add remove programs or some
other method).

I have WM_QUERYENDSESSION (&H11) but I don't know what value is sent when
Add/Remove programs is run that I assume tries to terminate the running

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