Exiting app with a code

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have a vb.net app which used SUB Main. How can I at the end of SUB Main
exit with an exit code picked up by the app that is calling my vb.net app
exe?

Many Thanks

Regards
 
Hi

I have a vb.net app which used SUB Main. How can I at the end of SUB Main
exit with an exit code picked up by the app that is calling my vb.net app
exe?

Many Thanks

Regards

Change your Sub Main to Function Main, and then return a value:

Function Main () As Integer
' do a lot of really neat stuff
Return 0 ' success? you can return what ever you want.
End Function

Valid declaratons for Main in VB.NET:

Sub Main()
Sub Main(ByVal args() As String)
Function Main() As Integer
Function Main(ByVal args() As String) As Integer
 
Back
Top