Hello guys,
I'm trying to get the total cpu usage in VB.net 2010 with the help of Performance Counter.
Above code is working fine on my computer, but when i'm running it on another computer (in windows 7 ultimate) i'm getting error. Please see the attached snapshot.
How can I solve this error ?
Regards,
![Name: Untitled.png
Views: 146
Size: 33.9 KB]()
I'm trying to get the total cpu usage in VB.net 2010 with the help of Performance Counter.
Code:
Public Class Form1
Dim cpu As New PerformanceCounter()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With cpu
.CategoryName = "Processor"
.CounterName = "% Processor Time"
.InstanceName = "_Total"
End With
Me.Text = cpu.NextValue.ToString
End Sub
End ClassHow can I solve this error ?
Regards,