0

How do I get the console from closing immediatley upon opening in a Console Application program? I have all of the code written but when I run the program it pops up the console window and then immediatley exits so I am unable to read what is in the window to see if my program is operating correctly. This is the first time I've ever used a console window so I don't know where in the code I would need to put "whatever it is" I might need to put to keep the window open until closed by the user.

6
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by Begginnerdev
0

Also to slow things down you can use Thread.Sleep(100) to slow it down by a 1/10 of a second.

Imports System.Threading
Console.WriteLine("Sleep for 2 seconds.")
Thread.Sleep(2000)
0

If you're running this from Visual Studio, you can set a breakpoint on your last line and the program will pause there.

Also, you could actually run the executable FROM the command-line (instead of Visual Studio or double-clicking an icon).

0

Good idea, thines01. Open CMD.exe and navigate to your debug or release folder and then type in the executables name.

0

Could wrap the whole thing in a while loop too.

Dim ex As String = ""

        While ex <> "exit"

            'your code here

            Console.WriteLine("Type exit to exit the application")
            ex = Console.ReadLine()
        End While
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.