I would like to prevent a user from starting up an other 'instance' of a vb application when clicking on the desktop icon if that application is already open on the desktop. How do I go about doing this? Thanks in advance for your help!
Printable View
I would like to prevent a user from starting up an other 'instance' of a vb application when clicking on the desktop icon if that application is already open on the desktop. How do I go about doing this? Thanks in advance for your help!
use App.PrevInstance..VB Code:
Private Sub Form_Load() If App.PrevInstance = True Then MsgBox "Only 1 instance!", vbCritical End End If End Sub
HA... DON'T USE THE END STATEMENT. I would have though you would have figured that out by now chris. Always do this
VB Code:
dim f as form for each form in forms unload f set f = nothing next f
I was about to say that. :pQuote:
Originally posted by Skitchen8
HA... DON'T USE THE END STATEMENT.[/Highlight]
lol
Bollocks to it. I can't be arsed to type a load of For Each Frm In Forms crap in a ****ing demo. Don't be so damn pedantic
damn, i was kidding
Maybe you were, but don't ***** at me for using End...
You app has only got chance to open 1 form if using that cod, so it's fine just to put Unload Me anyway...
ok... ok, we weren't bitching at you we were suggesting to Laura Moloney to use that code because it will free up the memory used by your app
I thank you all for jumping in and not only answering my original question so quickly, but also remind me of good programming techniques, something I find useful to be reminded of from time to time. Plus the added bonus was that in my code, I was unloading forms individually, so the 'shortcut' shown here is very helpful! I also have to say I enjoyed your playful(?) bickering. KUDOS to all of you.................
yes, our bickering is always enjoyable to watch....
We all love each other really :DQuote:
Originally posted by Laura Moloney
I also have to say I enjoyed your playful(?) bickering. KUDOS to all of you.................
NO CHRIS, I THOUGHT I TOLD YOU I WASN'T GAY ANYMORE... LOL j/k i love you too :D