Reputation: 41
Ok so, I have all my program and what not, it's just I don't how to prevent it from quitting the program after the execution of a
private sub
Like for example, I have
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
but after I hit any other key, the program terminates. How do I prevent the program from terminating, and going back to the
sub main()
Here is my data code for the entire program, it's 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
but after I select the case that I want to use and head into the sub code for the
keylists, it just terminates, and it doesn't even wait for me to read it. I'll literally provide video of it happening if it helps anyone... I am desperate...
Upvotes: 1
Views: 230
Reputation: 32445
Put your Select case
block in the loop, add one more option ("Exit" for example) - if that option will be selected exit loop and application will be exited.
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
Upvotes: 1
Reputation: 885
This application will only hit the Console.ReadLine()
if the user entered "Site". Move the Readline statement below the End Select
statement and it will do what you want.
Upvotes: 0