Hi group,

I already build a program with vb6. The problem is when the program is running and user click the exe file again then it makes program running twice in same time.
Is there a way to restrict this happened?

Thank you.

I already build a program with vb6. The problem is when the program is running and user click the exe file again then it makes program running twice in same time.
Is there a way to restrict this happened?

Something like this should working :

Private Sub Form_Load()
    If App.PrevInstance = True Then
        MsgBox "Application is running!", vbExclamation, "Warning"
        End
    End If
End Sub
commented: Very simple code but worked great!! +3

Wow..
I don't that it just a very simple code.
Thank you for quick help sir

You're welcome.

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.