How To Make A CPU Performance Meter In VB.NET

just thought to write this , this tutorial is about making a cpu performance meter in vb.net so lets get started

1.open visual basic 2008/2010

2.create a new project and name it whatever you want

3.now if you want to change the form text property and other thing just change them

4.add a performance counter from the toolbox and change its properties as given below

Counter Name - % Processor Time
Instant Name - Idle/0
Category Name - Thread


5.add a label

6.add a timer and change its interval to 1000 and enable it .

7.now add a progressbar

8.now double click your form and add this codes

Public Class Form1


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim cpuLoad As Integer = CDec(Performancecounter1.NextValue.ToString())
        cpuLoad = 100 - cpuLoad
        Label1.Text = cpuLoad.ToString() & "%"
        On Error Resume Next
        ProgressBar1.Value = cpuLoad.ToString

    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

9.debug and see your cpu performance



Post a Comment

Note: Only a member of this blog may post a comment.