Get PC hardware info / VB .NET
Visual Basic .NET
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Imports System.Management Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Очищаем TextBox TextBox1.Text = "" Try Dim searcher As New ManagementObjectSearcher searcher.Query = New SelectQuery("Select * From Win32_BaseBoard") Dim obj As ManagementObject Dim prop As PropertyData For Each obj In searcher.Get For Each prop In obj.Properties If IsNothing(prop.Value) = True Then TextBox1.Text &= prop.Name & " = {Nothing}" & vbCrLf Else TextBox1.Text &= prop.Name & " = " & prop.Value.ToString & vbCrLf End If Next Next Catch exp As Exception MsgBox(exp.Message, MsgBoxStyle.Critical) End Try End Sub End Class |