Get Computer Infomation [ BASIC ]


Public Class Form1
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents TextBox8 As System.Windows.Forms.TextBox

Private Sub Form1_Load() Handles MyBase.Load
‘———————- ADD CONTROL
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.Label7 = New System.Windows.Forms.Label
Me.Label8 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.TextBox8 = New System.Windows.Forms.TextBox
‘————————————

‘———————- BEGIN CONFIG
‘ ##################### Label
Me.Label1.Location = New System.Drawing.Point(10, 25)
Me.Label2.Location = New System.Drawing.Point(10, 50)
Me.Label3.Location = New System.Drawing.Point(10, 75)
Me.Label4.Location = New System.Drawing.Point(10, 100)
Me.Label5.Location = New System.Drawing.Point(10, 125)
Me.Label6.Location = New System.Drawing.Point(10, 150)
Me.Label7.Location = New System.Drawing.Point(10, 175)
Me.Label8.Location = New System.Drawing.Point(10, 200)

‘ ##################### TextBox
Me.TextBox1.Size = New System.Drawing.Size(160, 20)
Me.TextBox2.Size = New System.Drawing.Size(160, 20)
Me.TextBox3.Size = New System.Drawing.Size(160, 20)
Me.TextBox4.Size = New System.Drawing.Size(160, 20)
Me.TextBox5.Size = New System.Drawing.Size(160, 20)
Me.TextBox6.Size = New System.Drawing.Size(160, 20)
Me.TextBox7.Size = New System.Drawing.Size(160, 20)
Me.TextBox8.Size = New System.Drawing.Size(160, 20)

Me.TextBox1.Location = New System.Drawing.Point(110, 25)
Me.TextBox2.Location = New System.Drawing.Point(110, 50)
Me.TextBox3.Location = New System.Drawing.Point(110, 75)
Me.TextBox4.Location = New System.Drawing.Point(110, 100)
Me.TextBox5.Location = New System.Drawing.Point(110, 125)
Me.TextBox6.Location = New System.Drawing.Point(110, 150)
Me.TextBox7.Location = New System.Drawing.Point(110, 175)
Me.TextBox8.Location = New System.Drawing.Point(110, 200)

Me.TextBox1.ReadOnly = True
Me.TextBox2.ReadOnly = True
Me.TextBox3.ReadOnly = True
Me.TextBox4.ReadOnly = True
Me.TextBox5.ReadOnly = True
Me.TextBox6.ReadOnly = True
Me.TextBox7.ReadOnly = True
Me.TextBox8.ReadOnly = True

‘ ##################### Form
Me.ClientSize = New System.Drawing.Size(285, 230)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.TextBox8)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = “Form1”
Me.Text = “Form1”
‘———————- END CONFIG

‘———————- BEGIN COMMAND
Label1.Text = “Computer Name”
Label2.Text = “User Name”
Label3.Text = “OS Name”
Label4.Text = “Cap Lock”
Label5.Text = “Screen Resolution”
Label6.Text = “OS Version”
Label7.Text = “ProductName”
Label8.Text = “DisplayName”

TextBox1.Text = My.Computer.Name
TextBox2.Text = My.User.Name
TextBox3.Text = My.Computer.Info.OSFullName
TextBox4.Text = My.Computer.Keyboard.CapsLock
TextBox5.Text = My.Computer.Screen.WorkingArea.Size.Width & ” x ” & _
My.Computer.Screen.WorkingArea.Size.Height & ” – ” & _
My.Computer.Screen.BitsPerPixel.ToString & ” Bit ”
TextBox6.Text = My.Computer.Info.OSVersion
TextBox7.Text = My.Application.Info.ProductName
TextBox8.Text = My.Application.UICulture.DisplayName.ToString
If TextBox4.Text = “True” Then
TextBox4.Text = “ON”
Else
TextBox4.Text = “OFF”
End If
‘———————- END COMMAND
End Sub
End Class

สร้าง form ใหม่ วางโค้ด แล้วรันดูผลได้เลยครับ

Published by

sornram9254

Ayutthaya Technical College/Voc.Cert.🛠️ | KMUTNB/B.S.Tech.Ed.⚙️ | Information Security Engineer 👨🏻‍💻| Penetration Tester👨🏻‍💻 | COYG🔴 Milan🔴⚫️ | Taylor Swift👩‍🎤 | ติ่งซีรีส์ญี่ปุ่น 🇯🇵

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.