Monday, July 6, 2009

Setting the Exit Code when exiting a VB.NET or C# Console App

To set the Exit Code (ErrorLevel) when a VB.NET or C# Console Application exits, use the following (or similar):

Dim retCode as Integer = 0
.
.
.
System.Environment.Exit( retCode)



The call to Exit will end the application.

No comments: