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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top