Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Public Function GetDriveSerialNumber() As String Dim DriveSerial As Integer 'Create a FileSystemObject object Dim fso As Object = CreateObject("Scripting.FileSystemObject") Dim Drv As Object = fso.GetDrive(fso.GetDriveName(Application.StartupPath)) With Drv If .IsReady Then DriveSerial = .SerialNumber Else '"Drive Not Ready!" DriveSerial = -1 End If End With Return DriveSerial.ToString("X2") End Function End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)