Sub Main Ends so does the application

  • Thread starter Thread starter rrowe
  • Start date Start date
R

rrowe

Admittedly, I am new to VB.NET

I have some real simple code that I am trying to run in VB.NET

Friend Module xxx
Friend F1 As Form1
-----------------

Public Sub Main()

F1 = New Form1

Form1.Show()

End Sub

All I am trying to do is show the form. However, at the End Sub statement
the form closes..... I am confused. Any ideas?
 
if you want to use forms, create a Windows Application, at the end of the
sub, the program terminates, so if you want to use forms (usually) you want
to use a Windows Application
 
Hello Jim,

Actually using the OP's original code fragment it would be Application.Run(F1)..

or, optionally Application.Run(new Form1)


-Boo
 
RRowe,

Just as addition,

Did you know that a VBNet mainform has an inbuild submain with an
application run as long as you have not done that yourself.

Cor
 
Cor said:
RRowe,

Just as addition,

Did you know that a VBNet mainform has an inbuild submain with an
application run as long as you have not done that yourself.

Cor

But if you want to do things like enable visual styles, read a config
file or manually display a splash screen, you will need to make it.
 
Back
Top