Re: Me.Close




I'm converting a vb.net app that uses windows forms, into a module with a sub main() console with no forms.

Everything looks good except, how do I close my module. My intellisense does not like

VB Code: Me.Close() , console apps just close when there is no further processing going on, and there is no further request for input..

perhaps you should examine each readline string that in input by the user, and if they typed exit, the app should close.. otherwise prompt another readline (or read, etc..) to keep the console open.. , Heavens alive, there are some bad practices out there.

Klienma is 100% correct, console applications, and in fact all applications, close by themselves. Programs don't stay open when they are not doing anything. The only reason a windowed app stays open is because it is executing a message loop for each window - Same principle for the OS, otherwise it would shut down as soon as it had finished starting up.

So, to close your application, don't do anything. It will close when the code flow reaches the end of Main() - your job is to make sure it gets itself there in the right circumstances. Using an Exit() method or the End keyword is just a lazy cop-out. , Originally Posted by dom_stapleton Unless you wish to exit the program prematurely... What did you think I was talking about My favourite brand of detergent
Posted On: Saturday 3rd of November 2012 12:49:14 PM Total Views:  198
View Complete with Replies