Dim p() As Process = Process.GetProcessesByName("NameOfProcess")
What I can't figure out is how do I do for example use an if statement with it
If this process is running than do this
Also if anyone can help me with what does the code above actually output I've tried to display P() through a msgbox and it does nothing always gives me an index out of bounds error and I've tried it with running processes and non running ones, and I've tried it with a number of different index's.
Any help would be greatly appreciated. Thanks in advance.

Running Applications?
Mikepy
The code outputs an array of processes with the given name>
Dim NameOfProcess As String = "Notepad" Dim p() As Process = Process.GetProcessesByName(NameOfProcess) If p.Length > 0 Then MessageBox.Show(p.Length & " Process(s) Named " & NameOfProcess & " are running!") p(0).Kill() 'this kills the first process in the array of processes End If