Imports System.Management
FormLoad
TextBox1.Text = GetVolumeSerialNumber("C") 'ล๊อกตามได C
Public Function GetVolumeSerialNumber(ByVal driveletter As String) As String
Dim mobjSearcher As New ManagementObjectSearcher _
("SELECT * FROM Win32_LogicalDisk WHERE Name = '" & driveletter & ":'")
For Each obj As ManagementObject In mobjSearcher.Get
Return obj("VolumeSerialNumber")
Next
End Function