Shell.ErrorCode

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Integer )
aShell.ErrorCode = newIntegerValue
or
IntegerValue = aShell.ErrorCode

Supported for all project types and targets.

The error code returned by the shell.

Notes

It returns 0 if the Execute method was executed successfully. Otherwise, it returns a system-supplied error code. On Windows, it returns -1 if execution fails.

Example

This example checks the value of error code and prints it if it is not zero.

Var sh As New Shell

sh.Backend = TextField1.Value
sh.Arguments = TextField2.Value
sh.Execute TextField3.Value
TextArea1.Value = sh.Result
If sh.ErrorCode <> 0 Then
MsgBox("The error code is: " + Str(sh.ErrorCode))
End If