Dim appName As String = Process.GetCurrentProcess.ProcessName
Dim sameProcessTotal As Integer = Process.GetProcessesByName("ชื่อProcess").Length
If sameProcessTotal >= 1 Then
Application.Exit()
End If
หรืออีกโค้ดนึ่ง
Code (VB.NET)
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("ชื่อProcess")
For Each p As Process In pProcess
Application.Exit()
Next