Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

creating a menue in vb.net help required

Posted on 2011-03-17
3
Medium Priority
?
307 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:mahmood_786
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 35159839
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

0
 

Author Comment

by:mahmood_786
ID: 35160959
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....

0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 35161016
Ok...you could do:
Select Case response
            Case "1"
                Console.Write("FileName: ")
                Dim FileName As String = Console.ReadLine()
                Console.Write("Title: ")
                Dim Title As String = Console.ReadLine()
                Console.Write("Full Name: ")
                Dim FullName As String = Console.ReadLine()

                ... now do something with "FileName", "Title", and "FullName"...

            Case "2"

            Case "3"

            Case Else
                Console.WriteLine("Unknown Response")

        End Select

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question