Use While to read user input : Console Read « Language Basics « VB.Net Tutorial






Module Module1

    Sub Main()
        Console.WriteLine("Please enter 'q' to quit...")
        Dim strInput As String = Console.ReadLine()

        While (strInput <> "q")
            Console.WriteLine("You typed " & strInput)
            Console.WriteLine("Please enter 'q' to quit...")
            strInput = Console.ReadLine()
        End While
        Console.WriteLine("Quitting now.")

    End Sub

End Module
Please enter 'q' to quit...
q
Quitting now.








1.3.Console Read
1.3.1.Read a single character
1.3.2.Read a complete line of text
1.3.3.Read a string from console
1.3.4.Read keyboard input
1.3.5.Use Do Loop to read user input
1.3.6.Convert what you type to value type
1.3.7.Use While to read user input
1.3.8.Match a pattern from user input