Tuesday, November 27, 2012

Closing Parent Form from Child Form in VB.NET

The Application.Exit() call can be made in the child form's FormClosed event to exist the app when the child form is closed.


    Private Sub Form_Child_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        Application.Exit()

    End Sub

Unload Event equivalent in VB.NET



For VB.NET, you can use the FormClosed or FormClosing in place of the VB6 Unload event.