Use GOTO to deal with user input : Goto « Language Basics « VB.Net






Use GOTO to deal with user input

Use GOTO to deal with user input
Imports System


Public Class MainClass

   Shared Sub Main()
        Dim getData As String
        Dim i, j As Integer
        For i = 1 To 10
            For j = 1 To 100
                Console.Write("Type the data, hit the Enter key between " & _
                    "Q to end:  ")
                getData = Console.ReadLine()
                If getData = "Q" Then
                    GoTo BadInput
                Else
                    'Process data
                End If
            Next j
        Next i
        Exit Sub
BadInput:
        Console.WriteLine("Data entry ended at user request")
   End Sub 

End Class


           
       








Related examples in the same category

1.Goto a LabelGoto a Label
2.On Error go to lineOn Error go to line
3.Goto StatementGoto Statement