Andrew Henz Andrew Henz - 2 years ago 168 Question battery life percentage

I tried many methods trying to make a small programs which shows the battery percentage (the value is displayed on a progressbar).Can anyone help me?

Answer Source
Dim power As SystemInformation.PowerStatus = SystemInformation.PowerStatus
Dim percent As Single = power.BatteryLifePercent    

' Display the ProgressBar control.
    pBar1.Visible = true;

' Set min and max
    pBar1.Minimum = 0
    pBar1.Maximum = 100

' Set the current value 
    pBar1.Value = percent * 100

Then you just need to refresh with a timer or something else.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download