SystemInformation.PowerStatus.BatteryLifeRemaining returns -1?

Posted by dsrdakota on Stack Overflow See other posts from Stack Overflow or by dsrdakota
Published on 2012-11-11T04:55:26Z Indexed on 2012/11/11 5:00 UTC
Read the original article Hit count: 200

In my code I have:

Dim ps as PowerStatus = SystemInformation.PowerStatus
Dim batteryTimeLeft as Integer = ps.BatteryLifeRemaining 'I have a problem here

MsgBox("Time left on battery: " & cstr(batteryTimeLeft),vbInformation,"Info")

PowerStatus.BatteryLifeRemaining always returns -1 when I have a battery present and used or when not used. Why does this always return -1?

I currently am using MS .NET 4.0 Client Profile on VB.NET 2010 Express. I unplug the for my laptop and see if it makes a difference and it doesn't. Also tried in plugged in.

Help please???

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net