Link to home
Start Free TrialLog in
Avatar of mahmood_786
mahmood_786Flag for United Kingdom of Great Britain and Northern Ireland

asked on

creating a menue in vb.net help required

I am creating a menu in vb.net 2005. It is in console mode and it has if I press 1 it takes me to a different file and if press 2 to a different file and so on. can anybody tell how this can be achieved using coding?
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

You display the menu using Console.WriteLine() and Console.Write().

To get a value from the user, output a prompt with WriteLine() then wait for an answer back with ReadLine().

For example:
Module Module1

    Sub Main()
        Console.WriteLine("Main Menu:")
        Console.WriteLine("----------------------------")
        Console.WriteLine("(1) Chess")
        Console.WriteLine("(2) Poker")
        Console.WriteLine("(3) Global Thermonuclear War")
        Console.WriteLine("")
        Console.WriteLine("(4) Exit")
        Console.WriteLine("----------------------------")
        Console.Write("Your choice: ")
        Dim response As String = Console.ReadLine()
        Select Case response
            Case "1"

            Case "2"

            Case "3"
                Console.Write("Who shall we attack first? ")
                Dim target As String = Console.ReadLine()

            Case "4"

            Case Else
                Console.WriteLine("Unknown Response")

        End Select

        Console.WriteLine("Press Enter to Continue")
        Console.ReadLine()
    End Sub

End Module

Open in new window

Avatar of mahmood_786

ASKER

That is a nice example. But I need bit of more explaination what if it is a prgraomme like if someone presses 1 it takes you to the no to a differentcalss adn if press 2 to a siddernet calss. . I measn suppose there are 3 classes in the vb.net programme and calss 1 is called "customer", 2 is called "quotation" 3 is called "Help". So when 1 is pressed it will start like this enter the name of file to be created, when someone enters the file it name and hits enter it will say  tilte:  one title is entered it says (when enter is pressed) full name:  and so on. Similalry if 3 is presssed it shows help file and when 2 is pressed it says , enter the interest rate , enter the no. of months....etc....

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial