How to prevent multiple instances running when Application.Restart() is given in vb.net() form..

Thanks in advance...

hi try this in the form load section
'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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.