answersworst.blogg.se

Vb6 Get Serial Number


Hi to ALL I want to use the Hard disk Information like serial no., free space, used space, No. Of partitions, Etc. How I can get this information using my vb6 a. Nov 21, 2005  Retrieving a system serial number. Visual Basic.NET Forums..net > questions > retrieving a system serial number. What I need to get the serial number.

Imports System.Management Public Class Form1 Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim HDD_Serial, MB_serial As String Dim hdd As New ManagementObjectSearcher( 'select * from Win32_DiskDrive') For Each hd In hdd. Get HDD_Serial = hd( 'SerialNumber') Next Dim mboard As New ManagementObjectSearcher( 'select * from Win32_BaseBoard') For Each mb In mboard. Get MB_serial = mb( 'SerialNumber') Next End Sub End Class thank dear but there are errors in codes: Error 1 Type 'ManagementObjectSearcher' is not defined. C: Users Sh2007 Desktop hdd hdd Form1.vb 6 20 hdd Error 3 Statement cannot appear outside of a method body/multiline lambda. C: Users Sh2007 Desktop hdd hdd Form1.vb 9 5 hdd please help me. Private Sub Form7_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim HDD_Serial, MB_serial As String Dim hdd As New ManagementObjectSearcher( 'select * from Win32_DiskDrive') For Each hd In hdd.

Vb6 get disk serial number

Get HDD_Serial = hd( 'SerialNumber') Next Dim mboard As New ManagementObjectSearcher( 'select * from Win32_BaseBoard') For Each mb In mboard. Get MB_serial = mb( 'SerialNumber') Next MsgBox(MB_serial) End Sub Please mark those posts as answer which answers your question. Faraz thanks dear for your help but HDD_Serial is empty please check and help me . Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Dim Searcher_p As New ManagementObjectSearcher( 'root CIMV2', 'SELECT * FROM Win32_DiskDrive') For Each queryObj As ManagementObject In Searcher_p. Get() TextBox1.Text += (queryObj( 'SerialNumber').ToString.Trim) Next End Sub What is your main objective?

What do you want to do with these serial number? (Maybe there are better options available ) Please mark those posts as answer which answers your question.

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Dim Searcher_p As New ManagementObjectSearcher( 'root CIMV2', 'SELECT * FROM Win32_DiskDrive') For Each queryObj As ManagementObject In Searcher_p. Get() TextBox1.Text += (queryObj( 'SerialNumber').ToString.Trim) Next End Sub What is your main objective? What do you want to do with these serial number? (Maybe there are better options available ) Please mark those posts as answer which answers your question. Faraz thanks dear please see the picture there is an error Name of Allah, Most Gracious, Most Merciful and He created the human. Imports System.Management Public Class Form1 Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Searcher_P As New ManagementObjectSearcher( 'SELECT * FROM Win32_BaseBoard') For Each queryObj As ManagementObject In Searcher_P.