Loading Issues

  • Thread starter Thread starter bobba buoy
  • Start date Start date
B

bobba buoy

Guest
I migrated an app from vb6 with the migration wizard. When I run it, it immediately terminates. It is a multi-form app running from a sub-main in a module. I can't figure it out for the life of me, although I am a .Net rookie. Here is the Sub Main code:

<vb>
Public Sub Main()
Dim X As RWMain = New RWMain()
X.Show()
End Sub
</vb>

Is there something I should be looking for in the other forms that might cause this? I built a one-form trial app and it worked just fine. Then I added a module and ran it from the sub main in the module and it worked again. Any ideas?:wall:
 
Oops. wrong code enclosures
Visual Basic:
    Public Sub Main()
        Dim X As RWMain = New RWMain()
        X.Show()
    End Sub
 
To run a form in a Sub Main, you cannot just declare it and
show it. After showing it, the end of Sub Main will be reached, and
the program will terminate. You must use Application.Run to insure
that the Sub Main code stops at that line until the form is closed.

Visual Basic:
Public Sub Main()
  Dim X As RWMain = New RWMain()
  Application.Run(X)
End Sub
 
Back
Top