|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie VB QuestionAll,
Sorry if this is a really silly question, but..... Is it possible to set a return code for a DOS environment somewhere for a VB.NET app? When writing .BAT files for Windows 2000 I often need to use the ERRORLEVEL value to determine if a program was successful or not. How can I programmatically set this value from within VB.NET when my app exits? Cheers, Paul. "Paul Hadfield" <p***@anon.com> schrieb: 'Environment.ExitCode = <value>', 'Environment.Exit(<exit code>)', or a> Is it possible to set a return code for a DOS environment somewhere for a > VB.NET app? 'Function Main' that has a return value of type 'Integer'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Hi,
Neither of these seem to work. When the compiled .exe is run from a Windows XP command prompt, neither make any difference to the %ErrorLevel% - it remains set to 0. Sub Main() Environment.ExitCode = 999 End Sub Function Main() As Integer Return 999 End Function Also, each time I run the program from within the DDE it shows: The program '[3728] Test.exe' has exited with code 0 (0x0). I must be missing something simple. Any ideas? Cheers, Paul. Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:O7xCQfnPFHA.2136@TK2MSFTNGP14.phx.gbl... > "Paul Hadfield" <p***@anon.com> schrieb: >> Is it possible to set a return code for a DOS environment somewhere for a >> VB.NET app? > > 'Environment.ExitCode = <value>', 'Environment.Exit(<exit code>)', or a > 'Function Main' that has a return value of type 'Integer'. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> Sorry - I meant IDE (not DDE)
Show quoteHide quote "Paul Hadfield" <p***@anon.com> wrote in message news:OTpwtJ0PFHA.2356@TK2MSFTNGP14.phx.gbl... > Hi, > > Neither of these seem to work. When the compiled .exe is run from a > Windows XP command prompt, neither make any difference to the > %ErrorLevel% - it remains set to 0. > > > Sub Main() > Environment.ExitCode = 999 > End Sub > > > Function Main() As Integer > Return 999 > End Function > > > Also, each time I run the program from within the DDE it shows: > > The program '[3728] Test.exe' has exited with code 0 (0x0). > > I must be missing something simple. Any ideas? > > > Cheers, > Paul. > > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message > news:O7xCQfnPFHA.2136@TK2MSFTNGP14.phx.gbl... >> "Paul Hadfield" <p***@anon.com> schrieb: >>> Is it possible to set a return code for a DOS environment somewhere for >>> a VB.NET app? >> >> 'Environment.ExitCode = <value>', 'Environment.Exit(<exit code>)', or a >> 'Function Main' that has a return value of type 'Integer'. >> >> -- >> M S Herfried K. Wagner >> M V P <URL:http://dotnet.mvps.org/> >> V B <URL:http://classicvb.org/petition/> > > Paul,
Show quoteHide quote "Paul Hadfield" <p***@anon.com> schrieb: Are you sure you selected 'Sub Main' as startup object in the project > Neither of these seem to work. When the compiled .exe is run from a > Windows XP command prompt, neither make any difference to the > %ErrorLevel% - it remains set to 0. > > > Sub Main() > Environment.ExitCode = 999 > End Sub > > > Function Main() As Integer > Return 999 > End Function properties? > Also, each time I run the program from within the DDE it shows: The IDE will report incorrect values, that's a known "bug".> > The program '[3728] Test.exe' has exited with code 0 (0x0). -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP
cint and int32.parse Hide unwanted properties. Connection pool problems My application exits after handling an ApplicationException Error after removing row and then adding new row to datatable Lines and Boxes in VB.Net Public Variables in Module1 Bound combo box problem Connectionstring |
|||||||||||||||||||||||