CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Need help !

  1. #1
    Join Date
    Jan 2000
    Location
    Georgia
    Posts
    5

    Need help !

    Need to know how to keep a VB.exe from being open twice.


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Need help !

    This should work:

    Sub Main()
    If App.PrevInstance then
    End
    End If
    End Sub




    If your project is set to start in Sub Main then the above will work without modification, but if your project is set to start in a form, then paste the if block at the very beginning of the Form_Load() procedure of the main form.

    If you place that if statement as the first couple of lines of code that will be executed when the program starts up, it will ensure that if there is another version running, this one wont' start.

    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Jan 2000
    Location
    Georgia
    Posts
    5

    Re: Need help !

    Thanks for the help! I 'll give it a try.

    Mike


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured