Start and Kill Process using VB.NET

This is my other tutorial in VB.NET that start and kill a process or a program. This is not by means of killing someone. haha. LOL :) Starting a process or calling an application is just simple here in Just only add this syntax System.Diagnostics.Process.Start("This is the process that you are going to start") Take note that starting and opening a process is just the same. Now, let's start this Start and Kill Process tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Next, add two Buttons named Button1 labeled as "Start Notepad" and Button2 labeled as "Kill Notepad". You must design your layout like this: design 3. Next, put this code in the Button1_Click. This is to open and start your Notepad.
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. System.Diagnostics.Process.Start("notepad")
  3. End Sub
System.Diagnostics.Process.Start("notepad") - a syntax used to open your notepad. Take note that you can change any process as long as you have that syntax.


click 4. Now, code for Button2_Click. This button is killing all the process that has the Notepad Application. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim _proceses As Process() _proceses = Process.GetProcessesByName("notepad") For Each proces As Process In _proceses proces.Kill() Next MsgBox("Notepad process killed!") End Sub The GetProcessesByName(String) syntax here creates an array of new Process components and associates them with all the process resources on the local computer that share the specified process name. So meaning it will kill all the Notepad Process as we have this code
  1. For Each proces As Process In _proceses
  2. proces.Kill()
  3. Next
After killing or closing the Notepad, it will prompt the user "Notepad process killed!"


output Download the source code below and try it! :) For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz

Add new comment