Dec 11, 2010 08:35 AM
(This post was last modified: Dec 11, 2010 08:37 AM by The-One.)
Hello,
In this tutorial I will explain you how you can kill(you can do whatever you want, but i'll be using kill) multiple processes at once.
I'll be using:
- one Listview
- one Contextmenustrip
Okey,
First draw the items into the form.
Then, on top, under Public Class Form1 add:
Then in Form1_Load paste:
Click the contextmenu you previously added and add a new item name it Termiate (or whatever you want).
Okey, go into the designer, select the listview.
Set the next settings:
CheckBoxes = True(To put checkboxes infront of the items, you can use multiselect (Hit Ctrl and select multiple items, but I prefer checkboxes))
View = Details
ContextMenuStrip = ContextMenuStrip1(So where ever you right click (inside the listview ofcourse), the contextmenustrip will appear)
Add the following code to the contextmenu item.
You can use multiselect to, you just have to change:
into
and ofcourse, leave the checkboxes out.
Press F5 and check it out.
Fully programmed and wrote by me, reply's are welcome :)
In this tutorial I will explain you how you can kill(you can do whatever you want, but i'll be using kill) multiple processes at once.
I'll be using:
- one Listview
- one Contextmenustrip
Okey,
First draw the items into the form.
Then, on top, under Public Class Form1 add:
Code
Dim countitems As Integer = 0Then in Form1_Load paste:
Code
For Each p As Process In Process.GetProcesses
Dim lviList As New ListViewItem(New String() {p.ProcessName.ToString}) ' create a new line
ListView1.Items.Add(lviList) 'add it
countitems = countitems + 1
NextClick the contextmenu you previously added and add a new item name it Termiate (or whatever you want).
Okey, go into the designer, select the listview.
Set the next settings:
CheckBoxes = True(To put checkboxes infront of the items, you can use multiselect (Hit Ctrl and select multiple items, but I prefer checkboxes))
View = Details
ContextMenuStrip = ContextMenuStrip1(So where ever you right click (inside the listview ofcourse), the contextmenustrip will appear)
Add the following code to the contextmenu item.
Code
Dim index As Integer = 0 ' count
Dim str(0 To countitems) As String ' Max
Array.Clear(str, str.GetLowerBound(0), str.Length) ' clear the array
For Each lvi As ListViewItem In ListView1.CheckedItems ' for each checkbox checked
str(index) = lvi.Text ' set array
index = index + 1 ' index + 1 for next array
Next
For Each p As Process In Process.GetProcesses
For i = 0 To index - 1 ' Loop through all process strings we want to kill
If p.ProcessName.Contains(str(i)) Then ' if its equal
p.Kill() ' kill it
End If
Next
NextYou can use multiselect to, you just have to change:
Code
For Each lvi As ListViewItem In ListView1.CheckedItemsCode
For Each lvi As ListViewItem In ListView1.SelectedItemsand ofcourse, leave the checkboxes out.
Press F5 and check it out.
Fully programmed and wrote by me, reply's are welcome :)
FR1908

