Click to See Complete Forum and Search --> : Need help !


mbennett
January 26th, 2000, 01:04 PM
Need to know how to keep a VB.exe from being open twice.

Johnny101
January 26th, 2000, 02:45 PM
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

mbennett
January 27th, 2000, 06:40 AM
Thanks for the help! I 'll give it a try.

Mike