Console loop problem

rootuid

New member
Joined
Aug 7, 2010
Messages
1
Programming Experience
Beginner
Hi,
I'm having a pretty basic problem. I want a menu to be displayed in a console and loop until the input is the number 9. Here is my code.
VB.NET:
 Sub Main()
        Dim Userinput As Decimal
           Do Until Userinput = 9
        Loop
        Console.WriteLine("Select Product to order:")
        Console.WriteLine("1. : $1")
        Console.WriteLine("2. : $2")
                Userinput = Console.ReadLine()

        End Loop
    End Sub

However the loop isn't working. Any ideas what I'm doing wrong? I tried the same with a while loop but it didn't work.
 
Use the following code instead. I have tested the code it works.
To understand the different loops, visit VB.NET Loops

VB.NET:
        Dim Userinput As Decimal

        Do Until (Userinput = 9)
            Console.WriteLine("Select Product to order:")
            Console.WriteLine("1. : $1")
            Console.WriteLine("2. : $2")
            Userinput = Console.ReadLine()
        Loop
 
Back
Top