Multiple Forms

NegativeZero

Newcomer
Joined
Jan 23, 2005
Messages
11
i have more than one form, everytime i exit the first form the whole program ends, how do i take care of this little situation?
 
Last edited:
you can set Sub Main as your start up , then do this ...
Visual Basic:
'/// add a module to your application , then set it's Sub Main as your start-up object
Imports System.Windows.Forms

Module Module1
    Sub main()
        Dim frmMain As New Form1
        frmMain.Show()
        Application.Run() '/// NOTE : i run the application without a start-up Main form.
    End Sub
End Module
if you close the Form1 ( or any other Form ) the application will still be running , so make sure you handle this with some sort of boolean switch
eg:
Visual Basic:
Dim closeapp As Boolean

'/// in an unload function ( somewhere in your Application that can be accessed publicly )
If closeapp = True Then
    Application.Exit()
Else
    '/// do nothing
End If
 
Back
Top