running vb using Public Sub Main()

  • Thread starter Thread starter amith shetty
  • Start date Start date
A

amith shetty

Hi,
I am new to vb.net and am trying to run a simple program with Sub Main
as the start up in a module where i call the code to show a form. when i
run , the form is shown and the program ends .
how do i prevent this and transfer control to the form and let program
running.
Thanks in advance
 
amith shetty said:
I am new to vb.net and am trying to run a simple program
with Sub Main as the start up in a module where i call the code
to show a form. when i run , the form is shown and the program ends .
how do i prevent this and transfer control to the form and let program
running.

\\\
Imports System.Windows.Forms

Public Module Main
Public Sub Main
Application.Run(New Form1())
End Sub
End Module
///
 
I assume that, in your Sub main(), you are using something like:

Dim f As New f00

f.show

Instead of that you need to use:

Application.Run(New f00)

or

Dim f As New f00

Application.Run(f)
 
Back
Top