Hi Guys!Good day!

Ive notice just this day that the user of the program Ive made can double execute the program. I want the program to behave that when the process(task manager) of the program is already running, and when the user run the program again, the msgbox will show that "cannot run program because it is already running". I really dont know how to start the coding. Pls help.

Anybody has already made this program pls help me.

Thank you and God bless on this mother Earth.

Option Explicit

Private Sub Form_Load()
   If App.PrevInstance = True Then
      MsgBox "Program already running.", vbInformation, "Program status"
   ' End the program
   End
  
   End If
End Sub
commented: has the expertise +1
Option Explicit

Private Sub Form_Load()
   If App.PrevInstance = True Then
      MsgBox "Program already running.", vbInformation, "Program status"
   ' End the program
   End
  
   End If
End Sub

Thank you guys. This problem was solved.

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.