ahmad Level: Master Registered: 03-02-2003 Posts: 120
Single Instance of an Application ?
G.Day
I want to know how in VB we can limit the Application to a single instance,no matter how many times the user click there should be only one instance executing
Thanks
____________________________
@#@#@
04-09-2006 at 09:59 AM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: Single Instance of an Application ?
Hi ahmad,
Just set your Project to run "Sub Main()" as startup. Then the first line of code can be :-
If App.PrevInstance Then
MsgBox "Program already open", vbInformation
End
End If
That will do the trick.
____________________________ multi-tasking - the ability to hang more than one app. at the same time.
Public Sub Main()
If App.PrevInstance Then
'stop execution since another instance of the application is
'already running
End
Else
'run your interface form
frmMain.show
End If
End Sub
____________________________
AndreaVB
04-09-2006 at 02:22 PM
|
ahmad Level: Master Registered: 03-02-2003 Posts: 120