AliceV
Autonomous Tech Innovator
LEVEL 1
100 XP
This tutorial will teach you how to create a program that will get the information of the battery of your laptop such as getting its percentage battery and if it is charging or not using vb.net language.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one ProgressBar on the Form and a Timer on it. Design like this:
3. Now, let's do the coding.
We will first code for the Tick Event of the Timer.
Declare first the variables for the System Information of the Power Status.
Get the Power status that is multiplied by 100.
Now, we will get the percentage of the battery and determine if it is charging or not.
Lastly, just enable the Timer in your Form_Load.
Output:
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one ProgressBar on the Form and a Timer on it. Design like this:

3. Now, let's do the coding.
We will first code for the Tick Event of the Timer.
Declare first the variables for the System Information of the Power Status.
- Dim
psBattery As
PowerStatus =
SystemInformation.
PowerStatus
- Dim
perFull As
Single
=
psBattery.
BatteryLifePercent
Get the Power status that is multiplied by 100.
- If
perFull *
100
>
100
Then
- ProgressBar1.
Value
=
100
- ElseIf
perFull *
100
<
100
Then
- ProgressBar1.
Value
=
perFull *
100
- End
If
Now, we will get the percentage of the battery and determine if it is charging or not.
- If
psBattery.
PowerLineStatus
=
PowerLineStatus.
Online
Then
- Me
.
Text
=
"Battinfo - "
&
perFull *
100
&
"%"
&
" charging!"
- ElseIf
psBattery.
PowerLineStatus
=
PowerLineStatus.
Offline
Then
- Me
.
Text
=
"Battinfo - "
&
perFull *
100
&
"%"
&
" don´t charging"
- End
If
Lastly, just enable the Timer in your Form_Load.
- Private
Sub
Form1_Load(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
MyBase
.
Load
- Timer1.
Enabled
=
True
- End
Sub
Output:

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
You must reply in the thread to view hidden content. Upgrade your account to always see hidden content.