Exit WinForm app with an exit code

  • Thread starter Thread starter Anthony Hughes
  • Start date Start date
A

Anthony Hughes

Hi All,

I've got a Windows Forms app that I want to return an error code to the caller
- it's a utility in a larger build process and I need to aboort the build if
the utility fails.

I've tried Environment.Exit(<code>) but I only ever get 0x00 returned for any
number tried. Can't see any other way of doing this - surely it must be
possible somehow?

Cheers
Anthony
 
Anthony Hughes said:
I've got a Windows Forms app that I want to return an error code to the
caller
- it's a utility in a larger build process and I need to aboort the build
if
the utility fails.

I've tried Environment.Exit(<code>) but I only ever get 0x00 returned for
any
number tried. Can't see any other way of doing this - surely it must be
possible somehow?

Check the return value outside the IDE... Your code should work, but the
IDE does not get the right exit code for some reason.
 
Check the return value outside the IDE... Your code should work, but the
IDE does not get the right exit code for some reason.

Bizarre! I'll give that a try,

Thanks
Anthony
 
Back
Top