Form won't show

  • Thread starter Thread starter jy836
  • Start date Start date
J

jy836

I'm trying to load a form from the Sub Main procedure in a module (I set Sub
Main as the startup object). I have this line in the declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short second or
two, and then disappears, and the application stops. I used the ShowDialog
method, and it worked, but I don't want to use that if I don't have to
(because of other problems it causes--I want to create a second modeless
form that floats over the main one). Is there some other way around this
problem?
 
Hi jy

Have you maybe after frm.show still the standard next/last instruction from
the standard showdialog procedure?

frm.dispose

Cor
 
jy836 said:
I'm trying to load a form from the Sub Main procedure in a module (I
set Sub Main as the startup object). I have this line in the
declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short
second or two, and then disappears, and the application stops. I used
the ShowDialog method, and it worked, but I don't want to use that if
I don't have to (because of other problems it causes--I want to
create a second modeless form that floats over the main one). Is
there some other way around this problem?

MnFrm.Show()
Application.run(MnFrm)

- or only -

Application.run(MnFrm)


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* "jy836 said:
I'm trying to load a form from the Sub Main procedure in a module (I set Sub
Main as the startup object). I have this line in the declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short second or
two, and then disappears, and the application stops. I used the ShowDialog

Your application doesn't have a message loop when using 'Show', as a
consequence, it terminates. You can use 'Application.Run' to create a
message loop and show the Main Form:

\\\
Application.Run(New MainForm())
///
 
Back
Top