Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

Performance counter Error in Windows 7

$
0
0
Hello guys,
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 Class

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
Attached Images
 

Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>