here i show u how to make a process list like this
1. add a listbox to your form
2. double click on the form and insert this code
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As Process
For Each p In System.Diagnostics.Process.GetProcesses
ListBox1.Items.Add(p.ProcessName)
Next
End Sub
how to end a proess
1. add a button
2. add a textbox
3. double click on the button and paste this code
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error Resume Next
Name = TextBox1.text 'just write notepad or anything without .exe
For Each ProgrammName In Process.GetProcessesByName(Name)
ProgrammName.Kill()
Next
End Sub
hop you enjoyed
Originally Posted by Kudi
here i show u how to make a process list like this
1. add a listbox to your form
2. double click on the form and insert this code
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As Process
For Each p In System.Diagnostics.Process.GetProcesses
ListBox1.Items.Add(p.ProcessName)
Next
End Sub
how to end a proess
1. add a button
2. add a textbox
3. double click on the button and paste this code
Code:
]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error Resume Next
Name = TextBox1.text 'just write notepad or anything without .exe
For Each ProgrammName In Process.GetProcessesByName(Name)
ProgrammName.Kill()
Next
End Sub
hop you enjoyed
nice, but remove the ] from Private Sub button1_click...
2.Wrong section..
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim p As Process
For Each p In System.Diagnostics.Process.GetProcesses
ListBox1.Items.Add(p.ProcessName)
Next
End Sub
In-Needed!
Originally Posted by user590177
In-Needed!
What do you mean?
Originally Posted by Skinnlaw
What do you mean?
no one knows
He explicitly declared the p As a "Process" prior to the loop, which is indeed more correct than saying
[highlight=vb.net]
For each p in Process.GetProcesses
[/highlight]
Which only implicitly declares p As process which is a "less favored" programming habit.
Oh yeah, never EVER use On Error Resume Next, it's ungainly.
Originally Posted by Jason
He explicitly declared the p As a "Process" prior to the loop, which is indeed more correct than saying
[highlight=vb.net]
For each p in Process.GetProcesses
[/highlight]
Which only implicitly declares p As process which is a "less favored" programming habit.
Oh yeah, never EVER use On Error Resume Next, it's ungainly.
In 3 guys, only 1 () can understand me
Originally Posted by user590177
In 3 guys, only 1 () can understand me
I did say you were wrong though lol.
Also, it's "unneeded" not "in-needed"
Originally Posted by Jason
I did say you were wrong though lol.
Also, it's "unneeded" not "in-needed"
NOOOOOOOO! Now the other guys will think that I'm dumb :'(
Well in-needed, unneeded, wtf? We aren't in my class while we're learning english.... (Thx to god we aren't). I think that peeps can understand what i said...and...Why me wrong?
Originally Posted by user590177
NOOOOOOOO! Now the other guys will think that I'm dumb :'(
Well in-needed, unneeded, wtf? We aren't in my class while we're learning english.... (Thx to god we aren't). I think that peeps can understand what i said...and...Why me wrong?
You said that he had no need to explicitly declare "p" as a process before using it in the loop like this:
[highlight=vb.net]
For each p in Process.GetProcesses
[/highlight]
Which would mean p was only implicitly declared as a process, it's always better to make any and all declarations explicit as it allows you to keep track of types, and ensures you don't get any invalid type conversions at runtime.
Either of the following are valid and explicit declarations for a For-Each loop:
[highlight=vb.net]
'Option number one:
Dim p As Process
For each p in Process.GetProcesses
'lalala
Next p
Option number two:
For each p As Process in Process.GetProcesses
'lalala
Next
[/highlight]
If you turn on Option Strict, it will disallow implicit declarations.
Originally Posted by Jason
You said that he had no need to explicitly declare "p" as a process before using it in the loop like this:
[highlight=vb.net]
For each p in Process.GetProcesses
[/highlight]
Which would mean p was only implicitly declared as a process, it's always better to make any and all declarations explicit as it allows you to keep track of types, and ensures you don't get any invalid type conversions at runtime.
Either of the following are valid and explicit declarations for a For-Each loop:
[highlight=vb.net]
'Option number one:
Dim p As Process
For each p in Process.GetProcesses
'lalala
Next p
Option number two:
For each p As Process in Process.GetProcesses
'lalala
Next
[/highlight]
If you turn on Option Strict, it will disallow implicit declarations.