how can i know My Application is already running.I want to abort new application and pop up to user to close already running application.I am using App.PrevInstance object but its not working. I want to use mutex and windowform..how can i use it..Plzz help..

Use App.PrevInstance:

'this code would be in a bas module for start up.'
Private Sub main()
    'Check for previous instance and exit if found.'

    Dim rc As Long

    If App.PrevInstance Then
        rc = MsgBox("Application is already running", vbCritical, App.Title)
        Exit Sub
    Else
        frmMain.Show
    End If

End Sub

i used this code already..i made exes but nothing happened..whn i debug the code app.PrevInstance comes false always..

O.K. make it as simple as possible. This code works for me:

Private Sub Form_Load()
If App.PrevInstance Then
Msgbox("Running")
End
Else
Form1.Show
End If
End Sub
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.