Vb.net displays system information

Source: Internet
Author: User

Display System Information
Instance description
In this example, we use the sysinfo control to obtain information about the operating system, screen, and power supply. The program running result is 97-1.
Technical Points
L use the SysInfo Control
L obtain the OS version number and power attribute
Implementation Process
■ Create a project
Open Visual Studio. NET, select "New Project", select "Visual Basic Project" in the project type window, select "Windows application" in the template window, and enter "SysInfo" in the name field ", then select the Save path. Click OK ".
■ Add controls
Add ten Label controls to the form (you can arrange them using the "format" menu ).
■ Set attributes
Change the Text attribute of the Label control in the left column to be consistent with that on the interface.
■ Add code
Private Sub Form1_Load (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles MyBase. Load
'Get the operating system platform code, where 1 indicates 95/98, 2 indicates nt/2000 System
Select Case sysinfo. OSPlatform
Case 1
Label2.Text = "Windows95/98"
Case 2
Label2.Text = "WindowsNT/2000"
End Select
'Get the OS Version Number
Label4.Text = sysinfo. OSVersion & "." & sysinfo. OSBuild
'Get the desktop size
Label6.Text = sysinfo. WorkAreaHeight & "X" & sysinfo. WorkAreaWidth
'Obtain the power status value. 1 indicates the AC power, and 0 indicates the battery.
Select Case sysinfo. ACStatus
Case 1
Label8.Text = "AC power supply"
Case 0
Label8.Text = "battery"
End Select
'The batter' remaining time is obtained. When the batter' is AC power supply, the return value is-1, and the other return values are 255.
Select Case sysinfo. BatteryLifeTime

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.