I need to kill a specific process, i got ListBox1, and Button1 and Button2
Button1 Gets Process which is notepad, When Button1 is clicked in the ListBox1 it shows the Main titled of the windows, Example Notepad is running and his title is Untitled - Notepad in Listbox1 will show the title, And the Button2 Should kill the process of the selected item in the ListBox1, Like i Got 2 Notepad open, 1 with titled 1 and other with title 2, when i select in ListBox1 the one that says 1 and i click button2 it should kill the notepad process that have the titled 1 no all the notepads.
Button1 Code
Dim iGet() As Process = Process.GetProcessesByName("notepad")
Me.ListBox1.Items.Clear()
For Each Proc As Process In iGet
Me.ListBox1.Items.Add(Proc.MainWindowTitle)
Next
I need code for Button2
I got this for Button2
Dim proc() As Process = Process.GetProcesses
For i As Integer = 0 To proc.GetUpperBound(0)
If proc(i).ProcessName = "notepad" Then
proc(i).Kill()
End If
Next
But it closes all notepad process, not even selecting the iem from ListBox1 and then Button i need it, please help...