If you want to check whether there is a previous instance running for application you can use following code
| PublicSubCheckForInstance() |
| IfProcess.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length>1Then |
| MsgBox("Applicationisalreadyrunning") |
| EndIf |
| EndSub |
You can also check for previous instance using mutex.
http://www.freevbcode.com/ShowCode.Asp?ID=5845If you only want to allow one instance of application, you can select the checkbox "Make Single Instance Application" in Project->Application Properties and handle
StartNextInstance event.
Gaurav Khanna