tags:

views:

1089

answers:

4

How do I get the cpu usage percentage to display in the label on a form?

A: 

Look here: How to get the CPU Usage C#

Should be easy to translate to VB.Net

Gerrie Schenck
A: 

You can do it in .NET at least using the WMI API. WMI allows you to get a bunch of Windows Management type data such as CPU usage, hardare specs, etc.

http://www.aspfree.com/c/a/VB.NET/WMI-Programming-with-Visual-BasicNET-What-is-the-WQL/

Sean Turner
+1  A: 
Import Namespace System.Diagnostics

' ...
Dim cpu as New PerformanceCounter()
With cpu
    .CategoryName = "Processor"
    .CounterName = "% Processor Time"
    .InstanceName = "_Total"
End With

' ...
myLabel.Text = cpu.NextValue()
codekaizen
A: 

Check this http://www.codeproject.com/KB/system/processescpuusage.aspx is in c# but can't be converted easy for vb.net manualy or using this tool http://www.developerfusion.com/tools/convert/csharp-to-vb/

pho3nix