1,105,232 Community Members

Check Baterry Status

Member Avatar
Sawamura
Junior Poster in Training
69 posts since Nov 2007
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 11 [?]
 
0
 

How can i get battery status?
Any help will really appreciated.

Regards
Sawamura

Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
3
 

You can use SysInfo Component to get information about battery status.
Project->Component->Microsoft SysInfo Control
Add it to Form and use this following codes :

Private Sub Form_Load()
    List1.AddItem "BatteryFullTime = " & _
    Format$(SysInfo1.BatteryFullTime)
    List1.AddItem "BatteryLifeTime = " & _
    Format$(SysInfo1.BatteryLifeTime)
    List1.AddItem "BatteryLifePercent = " & _
    Format$(SysInfo1.BatteryLifePercent / 100, _
    "Percent")
    Select Case SysInfo1.BatteryStatus
    Case 1
    List1.AddItem "BatteryStatus = HIGH"
    Case 2
    List1.AddItem "BatteryStatus = LOW"
    Case 4
    List1.AddItem "BatteryStatus = CRITICAL"
    Case 128
    List1.AddItem "BatteryStatus = NO BATTERY"
    Case 255
    List1.AddItem "BatteryStatus = UNKNOWN"
    End Select
End Sub
Member Avatar
Sawamura
Junior Poster in Training
69 posts since Nov 2007
Reputation Points: 9 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 11 [?]
 
0
 

Thank You Jx_Man
It's worked nicely :)

Question Answered as of 2 Years Ago by Jx_Man
Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
1
 

You're Welcome

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: