After you copy the following code to your form,
Compile it (make an EXE file from your form). Compile the form by choosing from the menu
File -> Project1.exe and then click OK.
Now minimize Visual Basic and launch your compiled Project1.exe file (from where you
saved it) by double click him. double click him again and you got message box that the
program is already running and a second instance will not be opened.
Insert the following code to your form:
Private Sub Form_Load()
If App.PrevInstance = True Then
Call MsgBox("This program is already running!", vbExclamation)
End
End If
End Sub