简体   繁体   中英

how to call a sub in same module

I'm looking for a way to go back to the previous after the user reads a large message. The reason for it being in a separate sub is because it has 50+ lines of text and I wanted to cut down on load time. I must have gone all over the internet with not much luck finding an answer. I've tried this but get "process is terminated due to StackOverFlow Exception"

Heres the simple version of my code:

Sub notes()
    Dim a2 As String
    Do Until a2 = ("b") Or a2 = ("B")
        Console.Clear()
        Console.WriteLine("--------------------------------------------------------------------------------")
        Console.WriteLine("General Notes:")
        'more lines of text
        Console.WriteLine("--------------------------------------------------------------------------------")
        Console.WriteLine("Engine Status:")
        'more lines of text
        Console.WriteLine("Press <B> to go back to the menu")
        a2 = Console.ReadLine()
    Loop
    If a2 = ("b") Or a2 = ("B") Then
        Call Main()
    End If


End Sub

After notes sub is completed, eg a2 = "b" or a2 = "B", the program will automatically return to the main sub (assuming that you called it from there). You can't call the Main sub in the module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM