Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correct way to avoid duplicate instances 3

Status
Not open for further replies.

obulldog27

Programmer
Apr 26, 2004
169
US
I want to avoid having duplicate instances of my program
running. When I test this I get the msg but the program is
still loaded.

If App.PrevInstance = True Then
MsgBox "This program is already running!", vbExclamation
End
End If
 
Are you saying that the program does not stop running when it hits the End ?
 
yes if you click on the exeutible file then twice on instance get loaded with the database data and then the msg appears , I click ok and then the duplicate instance appears but with no data.
 
Is this the first line in your Sub Main() or Form_Load() ?
 
it is in the Form_Load()and No it is not exactly the first line in the function. I am using vb6 sp6

thanks
 
Put the check for the previous instance in a sub Main, and load the form from there if it's the first instance.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
And avoid using the END statement ( search the forum for background on why ). Use "Unload Me" instead.

Robert
 
See also thread222-616828 for the same topic in a different perspective.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top