Public Sub CheckForExistingInstance()
'Get number of processes of you program
If Process.GetProcessesByName _
(Process.GetCurrentProcess.ProcessName).Length > 1 Then
MessageBox.Show _
("Another Instance of this process is already running", _
"Multiple Instances Forbidden", _
MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
Application.Exit()
End If
End Sub
'Get number of processes of you program
If Process.GetProcessesByName _
(Process.GetCurrentProcess.ProcessName).Length > 1 Then
MessageBox.Show _
("Another Instance of this process is already running", _
"Multiple Instances Forbidden", _
MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
Application.Exit()
End If
End Sub