A Task Manager Tutorial
Posted: Sat Dec 04, 2010 11:05 pm
Level = ★☆☆☆☆
Hello, I hope all of you are having a good day. To begin I wanna say thanks, to everyone on the forum, for showing me how to code better! cooll;
Lets begin now, first create a new project, in this lets name it... Task Manager
On your form, you'll need
Name Button2: TaskKill
Keep listbox1 the same name.
Now, re-decorate your form, anchor stuff were you want it, do whatever.
Now it is time for coding!
Above the public class form1 code paste this:
Time for the next code.
Above 'End CLass' paste this:
![Image]()
Hello, I hope all of you are having a good day. To begin I wanna say thanks, to everyone on the forum, for showing me how to code better! cooll;
Lets begin now, first create a new project, in this lets name it... Task Manager
On your form, you'll need
- 1 list box
2 buttons
Name Button2: TaskKill
Keep listbox1 the same name.
Now, re-decorate your form, anchor stuff were you want it, do whatever.
Now it is time for coding!
Above the public class form1 code paste this:
Code: Select all
In the TaskRefresh_click code:
Imports System.IO
Code: Select all
TaskKill_Click code:
GetProcesses()
Code: Select all
You should have NOTHING but error's but thats okKillProcess()
GetProcesses()
Time for the next code.
Above 'End CLass' paste this:
Code: Select all
Thank you all, have good day/morning/night. Cya next time coder's! Public Sub GetProcesses()
ListBox1.Items.Clear()
Dim p As Process
For Each p In Process.GetProcesses
ListBox1.Items.Add(p.ProcessName)
Next
End Sub
Public Sub KillProcess()
Try
Dim p As Process
For Each p In Process.GetProcesses
If p.ProcessName = ListBox1.SelectedItem Then
p.Kill()
End If
Next
GetProcesses()
MsgBox("You just killed your sected item", vbOKOnly, "Worked")
Catch ex As Exception
MsgBox("Failed to close due to administrator rights!")
End Try
End Sub
