JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Ending a Program at Any Time

Our last topic in this chapter will be about ending programs. There are times when you want to end a program without further ado-for example, to make an Exit menu item active. How do you do that?

You use the End statement. This statement stops execution of your program; here's an example in which I end the program when the user types "Stop" (or "stop" or "STOP" and so on):

Module Module1
    Sub Main()
        Dim strInput As String
        Do Until UCase(strInput) = "STOP"
            System.Console.WriteLine("What should I do?")
            strInput = System.Console.ReadLine()
        Loop
        End
    End Sub
End Module
Tip 

The Stop statement is similar to End, except that it puts the program in a break state. Executing a Stop statement, therefore, will make the Visual Basic debugger come up.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor