如何使私有子返回子 main()

How to make a private sub go back to sub main()

好的,我有我所有的程序,但我不知道如何防止它在执行

后退出程序
private sub

例如,我有

 Private Sub KeyList()
    Console.WriteLine("1.) File - Opens a test file")
    Console.WriteLine("2.) Update - Updates the program using an external .bat file")
    Console.WriteLine("3.) Username - ReDo Your username")
    Console.WriteLine("4.) Site - Starts your browser and leads you to our site :D")
    Console.WriteLine("5.) PLUGIN_STRT_NOPROT - Starts the loaded plugin without layered protection, do not do this unless you know")
    Console.WriteLine("what you are doing")
    Console.WriteLine("6.) PLUGIN_STRT_PROT - Starts loaded plugin with protection, reccomended.")
    Console.WriteLine("7.) API_Str_Rand - Creates a random API string that you can assign to a plugin.")
    Console.WriteLine("8) DownloadDevKit - Downloads the developmental kit to create a plugin")

End Sub

但在我按下任何其他键后,程序终止。如何防止程序终止并返回到

sub main() 

这是我整个程序的数据代码,它是 VB.net 2010。

    Module Module1
Sub Main()
    REM Add all the Dimensions/Descriptions here.
    Dim VersionName As String = "1"
    Dim Action As String = "Action"
    Dim username As String = "UserName"
    REM The Visual part of the program. No pun intended :>

    REM Ask the name for the session.
    username:
    Console.WriteLine("Hello, What is your name? ")
    username = Console.ReadLine()
    Console.WriteLine("Hello " + username)
    If username = "Skycoder" Then
        Console.WriteLine("Welcome back!, Planned updates to include in this are, 1.) ADd in more key features")
        Console.WriteLine("2.) Add hotkeys")
        Console.WriteLine("3.) Implement and auto updater")
        Console.Beep()
        If username = "" Then
            Console.WriteLine("Please type in name. Numerals can be used")
            GoTo username
        End If
    End If
    Fish:
    Console.ReadLine()
    Console.Clear()
    Console.Title = ("Desktop TBI | Hello " + username)
    Console.WriteLine("-----------------------------------------------------------------------------------------------------------")
    Console.WriteLine("Please select an option, note that this is a work in progress, and will contain more features in the future")
    Console.WriteLine("")
    Console.WriteLine("                 Type 'File' to create the directory (Important if you want to add plugins)")
    Console.WriteLine("                                    Using Version: " + VersionName)
    Console.WriteLine("-----------------------------------------------------------------------------------------------------------")
    Console.WriteLine("                             Please choose what action you want to do")
    Console.WriteLine("                               Type in 'File' To find the directory")
    Console.WriteLine("                 Type in 'Update' To open the .bat file to download the updates")
    Console.WriteLine("-----------------------------------------------------------------------------------------------------------")
    Console.WriteLine("To create the new path, enter 'CreateDir'")
    REM Begin the part where users can select their code.
    Dim selection As String = Console.ReadLine
    Select Case selection
        REM This allows the creation of a text file.
        Case "File"
            Console.Clear()
            File() REM Private sub selection
            REM Updates their program.
        Case "Username"
            Console.Clear()
            GoTo UserName
            REM Set's their username for the program.
        Case "Update"
            Update()
        Case "KeyList"
            KeyList()
        Case "CreateDir"
            CreateDir()
        Case "SERV_Start"
            Chat_Start_SERV()
        Case "Site"
            Site()
            Console.ReadLine()
    End Select
End Sub       

但是在我 select 我想使用的情况下进入
的子代码 键列表,它只是终止,甚至不等我阅读它。如果它能帮助任何人,我会提供它发生的视频......我很绝望......

如果用户输入 "Site",此应用程序只会点击 Console.ReadLine()。将 Readline 语句移至 End Select 语句下方,它将执行您想要的操作。

将您的 Select case 块放入循环中,再添加一个选项(例如 "Exit")- 如果选择该选项,则退出循环并退出应用程序。

Console.WriteLine("0) Exit - Exit application")

Dim selection As String = Console.ReadLine()
While selection.Equals("Exit") = false
    Select Case selection
        REM This allows the creation of a text file.
        Case "File"
            Console.Clear()
            File() REM Private sub selection
        '...
        '... other Case values
        '...

    End Select
    selection = Console.ReadLine()
Loop