Sabtu, 25 Januari 2014

“System Information” dengan Visual Basic.NET 2010

System Information

Contoh sederhana mendapatkan informasi sistem pada sebuah komputer.

 

 

 

 

 

1. Jalankan terlebih dahulu aplikasi Visual Basic 2010

2. Pada tabulasi “Start Page” pilih “New Project” atau tekan tombol “Ctrl + N” pada keyboard

3. Pada jendela “New Project” pilih “Windows Forms Application” kemudian tekan tombol “OK

 

Control Properties

System Information layout

Object Name Properties Setting
Form Form1 Font
Form Border Style
Maximize Box
Start Position
Text
Tahoma; 8,25pt
Fixed Single
False
Center Screen
System Information
Label Label1 Text Label1

 

Event Program

Imports Microsoft.Win32
Public Class Form1
    Dim objRegSystem As RegistryKey
    Dim objRegComputer As RegistryKey
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        objRegSystem = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion")
        objRegComputer = Registry.LocalMachine.OpenSubKey("HARDWARE\DESCRIPTION\System\CentralProcessor\0")
        Label1.Text = "System: " & vbCrLf & My.Computer.Info.OSFullName & _
            vbCrLf & "Version " & objRegSystem.GetValue("CurrentVersion", "Default-Value").ToString & _
            " ( Build " & objRegSystem.GetValue("BuildLab", "Default-Value").ToString & " )" & _
            vbCrLf & objRegSystem.GetValue("CSDVersion", "Default-Value").ToString & _
            vbCrLf & vbCrLf & "Computer: " & vbCrLf & objRegComputer.GetValue("ProcessorNameString", "Default-Value").ToString & _
            vbCrLf & String.Format("Total Physical Memory: {0} MB", System.Math.Round(My.Computer.Info.TotalPhysicalMemory / (1024 * 1024)), 2).ToString & _
            vbCrLf & String.Format("Available Physical Memory: {0} MB", System.Math.Round(My.Computer.Info.AvailablePhysicalMemory / (1024 * 1024)), 2).ToString & _
            vbCrLf & String.Format("Total Virtual Memory: {0} MB", System.Math.Round(My.Computer.Info.TotalVirtualMemory / (1024 * 1024)), 2).ToString & _
            vbCrLf & String.Format("Available Virtual Memory: {0} MB", System.Math.Round(My.Computer.Info.AvailableVirtualMemory / (1024 * 1024)), 2).ToString
    End Sub
End Class

4. Klik tombol “Start Debuging” atau tekan tombol “F5” pada Keyboard untuk menjalankan aplikasi.

Label:

0 Komentar:

Posting Komentar

Berlangganan Posting Komentar [Atom]

<< Beranda