Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling the return value on a Vb.NET EXE

Is there a way to control the return value of an Executable Vb.NET or Vb 6.0, similar to C's exit() function?
0 Kudos
Message 1 of 4
(8,630 Views)
I haven't tried this myself, but
here's a bunch of other people who have posed this
question and here's a link to that group..
Theres an ExitProcess method that you can use, but it has some side effects that are discussed here....

http://groups.google.com/groups?as_q=exitprocess&safe=images&ie=UTF-8&oe=UTF-8&as_ugroup=*.vb.*&as_scoring=d&lr=lang_en&num=100&hl=en

hope this gets you started...
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 2 of 4
(8,630 Views)
The Main method of a Visual Basic .NET application can be one of the following four options:


  • Sub Main()

  • Sub Main(ByVal args() as String)

  • Function Main() As Integer

  • Function Main(ByVal args() as String) As Integer



If you define your Main method to return an integer (the third or fourth option above), the value that you return from Main will be the return value of the executable. For more information, see the MSDN article Structure of a Visual Basic Program.

- Elton
0 Kudos
Message 3 of 4
(8,630 Views)
Elton,

Thanks for your suggestion. I found the area in MSDN that disucusses this. I didn't think that Vb.net would use the same method as C... it was too obvious.

Thanks again
0 Kudos
Message 4 of 4
(8,630 Views)