M
Max45-1
Guest
Hi all,
I have this code and it works fine but the message doesn't appear when I try to run another instance of my application
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If PrevInstance() Then
MessageBox.Show("The App Is Already Running")
Me.Close()
Exit Sub
End If
End Sub
Function PrevInstance() As Boolean
If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
Return True
Else
Return False
End If
End Function
End Class
Continue reading...
I have this code and it works fine but the message doesn't appear when I try to run another instance of my application
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If PrevInstance() Then
MessageBox.Show("The App Is Already Running")
Me.Close()
Exit Sub
End If
End Sub
Function PrevInstance() As Boolean
If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
Return True
Else
Return False
End If
End Function
End Class
Continue reading...