Getting user input (user input from menu choices)

Discussion in 'Visual Basic ( VB )' started by Kenneth Reid, Dec 24, 2021.

  1. Kenneth Reid

    Kenneth Reid New Member

    Joined:
    Dec 22, 2021
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Occupation:
    Disabled
    I am trying to convert an older (1990s) Basic program that I wrote (in 1994) to the new VB 2022 standard, and I am having all kinds of problems, as the language has changed so drastically since I last did any Basic programming.

    My program will have a total of about 7 menus (1 main menu with 4 choices (4 new menus), and one of the 4 new menus will have 4 additional menus). One of the 4 main menu choices will have a total of 21 options to choose from. All the other menus will have between 5 and 9 menu options.

    I do not know how to write the code to allow the user to enter the menu choice they want to execute. The last menu choice for the "Main Menu" is to exit the program. The last two menu choice in all other menus is to return to the main menu and to exit the program. I don't know how to program these choices (to return to a specific menu or to exit the program).

    If I am doing things correctly in VB2022, the "main" part of the VB program should be in Sub Main with End Sub to close out this out. The other menus, as well as the remaining parts of the program should also be in Subs, with each sub having its own End Sub.
     

    Attached Files:

  2. Kenneth Reid

    Kenneth Reid New Member

    Joined:
    Dec 22, 2021
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Occupation:
    Disabled
    I tried to upload the VB file, but it didn't work. The code I am using for the "Sub Main" is below:

    Module Program
    Code:
        Sub Main()
    
            Console.WriteLine("                              Business Utilities")
            For A = 1 To 5
                Console.WriteLine("")
            Next
            Console.WriteLine("          1.  Management Utilities")
            Console.WriteLine("          2.  Management Decision Making")
            Console.WriteLine("          3.  Accountant's Helpers")
            Console.WriteLine("          4.  Time Is Money")
            Console.WriteLine("")
            Console.WriteLine("          5.  End Program")
            Console.WriteLine("")
            Console.WriteLine("")
            Console.WriteLine("                                  Your Choice? ")
            Dim Message, Choice
            Message = "Your Choice (Enter a value between 1 and 5): "
            Choice = InputBox(Message, DefaultResponse:="")
            If Choice = "1" Then
                Menu1()
            End If
    
            If Choice = "2" Then
                Menu2()
            End If
    
            If Choice = "3" Then
                Menu3()
            End If
    
            If Choice = "4" Then
                Menu4()
            End If
    
            If Choice = "5" Then
    
            End If
    
    
        End Sub
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice