Public Class Form1
Private P As Process
Private app As String = "notepad"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
P = Process.Start(app)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
For Each proc As Process In Process.GetProcessesByName(app)
If proc.Id <> P.Id Then
proc.CloseMainWindow()
End If
Next
End Sub
End Class