Search This Blog

Monday, January 21, 2013

Terminate application (VB.Net)

VB.NET > Statements > End

End  force the application to stop running.
  • closes files opened Open statement
  • clears all the application variables

Example:

End application on button click

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
        If MsgBox("Do you want to exit?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            End
        End If
    End Sub

End Class