Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Exit Code From VB application

Exit Code From VB application

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ANORTON
    wrote on last edited by
    #1

    I am writing a vb.net windows app that can be called from a scheduler or run as an application. How do I set a return or exit code for the application. i.e 0 if successfull or 1 if not. Thank you

    D 1 Reply Last reply
    0
    • A ANORTON

      I am writing a vb.net windows app that can be called from a scheduler or run as an application. How do I set a return or exit code for the application. i.e 0 if successfull or 1 if not. Thank you

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It is possible do this by setting the App Startup to Main startup, instead of a form. You can do this in the Project Properties. But, you must add a class to the project and add a main function something like this:

      Function Main() as Integer

      The this main must start the first form in your program, if you have one. You can use the help in Visual Studio or on MSDN and search for "Structure of a Visual Basic Program" to find an example. RageInTheMachine9532

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It is possible do this by setting the App Startup to Main startup, instead of a form. You can do this in the Project Properties. But, you must add a class to the project and add a main function something like this:

        Function Main() as Integer

        The this main must start the first form in your program, if you have one. You can use the help in Visual Studio or on MSDN and search for "Structure of a Visual Basic Program" to find an example. RageInTheMachine9532

        A Offline
        A Offline
        ANORTON
        wrote on last edited by
        #3

        Thanks I read this and picked up alot. It works though if anyone is curious the VS.IDE debugger always returns a 0 in that window. I had to use the windows scheduler to see the return code. Thats again :cool:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups