Return codes

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

how to return code from my app?

like in ol' dos progs

i need to call my app from a batch file and do some things based on the
return code

tnx
 
Environment.ExitCode

Property Value
A 32-bit signed integer containing the exit code. The default value is zero.

Remarks
This property can be used to return a success code from an application. For
example, it can be used to control the execution of a set of applications
invoked in a script. If the value of this property is not set by an
application, zero is returned.
 
Nikolay Petrov said:
how to return code from my app?

like in ol' dos progs

i need to call my app from a batch file and do some things based on the
return code

Add a new module to the project:

\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
MsgBox(Arg)
Next Arg
Application.Run(New MainForm())
If...Then
Return 0
Else
Return 1
...
End If
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
 

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