[VB.Net]Kill a process 03-26-2011, 05:16 PM
#1
Function:
Usage:
I thought i share cause this is a snippet that should be close to your hand every time you want to use it.
Credits go to VBForums
Code:
''' <summary>
''' Kills a process which is selected.
''' </summary>
''' <param name="ProcessName">The process you want killed.</param>
''' <remarks></remarks>
Public Function KillProcess(ByRef ProcessName As String)
Dim RunningProcess As System.Diagnostics.Process = Process.GetProcessesByName(ProcessName)(0)
RunningProcess.Kill()
Return RunningProcess
End Function
Usage:
Code:
KillProcess("explorer")
KillProcess("notepad")
I thought i share cause this is a snippet that should be close to your hand every time you want to use it.
Credits go to VBForums
Pierce the life fibers with your drill.