Console Application Question

I recently purchased a VB.NET 2005 reference book where the sample code is in console applications. I have done a bit with windows forms, but am unfamiliar with console apps. When I try run the sample code, the command prompt window closes and the application terminates as soon as "Sub Main" executes. I got around this by adding

strInput = Console.ReadLine

Do While Not (strInput.ToUpper = "QUIT")

strInput = Console.ReadLine

Loop

to the bottom of sub main so that I can just type in quit to terminate the application. This works, but I'm wondering if there is some other standard way that this is normally done.

Thanks,

Dave



Answer this question

Console Application Question

  • oguevarra

    Thanks, DMan1

    -Dave


  • Nagie_Stopy

    That behavior is normal for a console app. A console app will execute all lines of code in the Sub Main and then close. Your procedure for keeping it open for user input is correct.

    HTH



  • Console Application Question