Viper151
Viper151

Reputation: 30

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

Upvotes: 0

Views: 234

Answers (1)

Eminem
Eminem

Reputation: 870

After notes sub is completed, e.g 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.

Upvotes: 1

Related Questions