VB exit application

If you want to close a window application, you will use the Exit() method of the Application class.
The example below the application will close when the Button1 is clicked.

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     Application.Exit()
   End Sub

Another to exit the application is using Exit(exitcode) of the Environment class.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     Environment.Exit(0) ' exit code 0 means the application terminates without any problem or error
   End Sub

Posted by: Dara | post date: 02-19-2013 | Subject: VB.NET Programming Language




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.