Sinisterly
[VB.Net]Kill a process - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: [VB.Net]Kill a process (/Thread-VB-Net-Kill-a-process)



[VB.Net]Kill a process - 1234hotmaster - 03-26-2011

Function:
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


RE: [VB.Net]Kill a process - Shadow Hunter - 03-26-2011

thanks for this post buddy Smile ..this is seriously useful..btw the ' ' ' are they single lined comments?


RE: [VB.Net]Kill a process - 1234hotmaster - 03-26-2011

np Smile

well, in intellisense or the VS compiler it will show as tips.


RE: [VB.Net]Kill a process - Shadow Hunter - 03-26-2011

ooooo ok Smile thanks for telling me...


RE: [VB.Net]Kill a process - mikahlamka - 03-27-2011

Dud! i really want to learn this more! can you make a video tutorial for this? :thumbs:


RE: [VB.Net]Kill a process - 1234hotmaster - 03-27-2011

well... i don't get it. a video? this is simple. just copy paste the function to the code of your designer, then double click the form in the designer and type:
Code:
killprocess("yourprocesswithoutextension")

thats all!


RE: [VB.Net]Kill a process - mikahlamka - 03-27-2011

my designer??! what is that? a softwear ?? i really new and noob about this :p


RE: [VB.Net]Kill a process - 1234hotmaster - 03-27-2011

i mean Visual Studio designer.


RE: [VB.Net]Kill a process - mikahlamka - 03-27-2011

do it same with Microsoft Visual Studio?


RE: [VB.Net]Kill a process - FANBOY - 05-22-2011

it can be kill such thing like avira and other AV's ?