PDA

Click to See Complete Forum and Search --> : my console app closes right after the thing is displayed!


area91
Oct 9th, 2002, 08:09 PM
my console app closes right after the thing is displayed! how do i fix this?

Hu Flung Dung
Oct 9th, 2002, 08:36 PM
If you set the startup object to Sub Main (ex. In console apps), when Main() finnishes, your program ends! To prevent this, you either have to:

Design your app to keep Main() executing (Run a constant loop, for example).

Or you can call System.Windows.Forms.Application.Run(), which basically runs such a loop in the background.

area91
Oct 9th, 2002, 08:44 PM
or just that lol !

Console.ReadLine()

Slow_Learner
Oct 10th, 2002, 03:12 AM
Or you can run it from the Visual Studio .NET Command Prompt, but that requires a little typing (you would Build Solution and then switch to the command prompt window and type the executable name)