|
Average Rating: 4.4/5 | Rate this item | 8 users have rated this item.
|
Tip formerly from VB2TheMax
Expertise: beginner
Language: VB.NET
March 16, 2002
List all running Windows processes
The System.Diagnostics.Process class exposes the GetProcesses static method, that returns a list of all running processes. It is quite easy to leverage this feature to display all running processes in a ListBox or ComboBox control:
' This code assume that you've used the following Imports
' Imports System.Diagnostics.
' Start with an empty ListBox.
lstProcesses.Items.Clear()
' Display ProcessName property in the list area.
lstProcesses.DisplayMember = "ProcessName"
' Load info on all running processes in the ListBox control.
Dim p As Process
For Each p In Process.GetProcesses
lstProcesses.Items.Add(p)
Next
Francesco Balena
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
|