Here is my bit of code i think that this is a bit cleaner... i modify and take a bit of all your samples coz any has worked for me until now. and this can be on a botton control without problems.
Dim pro As Integer
Dim ProcessList As Process()
ProcessList = Process.GetProcesses()
Dim Proc As Process
For Each Proc In ProcessList
If Proc.ProcessName = "Name of Process to be closed" Then pro = Proc.Id
Next
Process.GetProcessById(pro).Kill()
If you dont know how the process is called u can use this code to know how is the names of all the processes currently running on the machine. :cool:
Dim ProcessList As Process()
ProcessList = Process.GetProcesses()
Dim Proc As Process
For Each Proc In ProcessList
msgBox(Proc.ProcessName & " " & Proc.Id)
Next
This will show you one by one all the process currently running with their Id on a Message Box, you only has to write down the name of the app that u want to close. :p