用Vb读取USB存储设备的序列号 [英] Reading the serial number of USB storage device in Vb

查看:26
本文介绍了用Vb读取USB存储设备的序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否用VB读取U盘的序列号.

Is it possible to read the serial number of a USB drive using VB.

推荐答案

这将为您提供有关 .net 驱动器的信息,包括 USB 设备只需导入这些

this will give you the info on your drives in .net, including usb devices Just import these

导入脚本导入 System.IO

Imports Scripting Imports System.IO

Private Class USBsn
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim driveNames As New List(Of String)
       For Each drive As DriveInfo In My.Computer.FileSystem.Drives
          Try
            Dim fso As Scripting.FileSystemObject
            Dim oDrive As Drive

            fso = CreateObject("Scripting.FileSystemObject")

            oDrive = fso.GetDrive(drive.Name)

            ListBox1.Items.Add(drive.Name & "   " & oDrive.SerialNumber)
        Catch ex As Exception
        End Try

        Next
    End Sub
End Class

这篇关于用Vb读取USB存储设备的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆