Unable to get user input to work properly

Discussion in 'Visual Basic ( VB )' started by Kenneth Reid, Dec 25, 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 get user input to work properly so that when the user enters their choice from a menu, it will take the user to the next menu (or to the actual menu function). For some reason, when the user enters their "selection", the program automatically ends. I'm not sure what I am doing wrong. My cose (just for the main menu) is shown below.
    Code:
    Sub Main()
            Dim Choice As string
            Console.Clear()
            Console.WriteLine("                                Business Programs")
            For i = 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.  Exit Program")
            Console.WriteLine("")
            Console.WriteLine("                                  Your Choice? ")
            Choice = Console.Read()
            While (Choice < 6)
                If (Choice = 1) Then
                    ManagementUtilities()
                ElseIf (Choice = 2) Then
                    ManagementDecisionMaking()
                ElseIf (Choice = 3) Then
                    AccountantsHelpers()
                ElseIf (Choice = 4) Then
                    TimeIsMoney()
                ElseIf Choice = 5 Then
                    End
                End If
            End While
        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