Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

usb detector

$
0
0
Hi, i have an application that detects a drive being inserted with this code:

Dim driveNames As New List(Of String)
        For Each drv As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives
            If drv.DriveType = IO.DriveType.Removable AndAlso drv.IsReady Then
                Dim drvLetter As String = drv.Name
                'Dim drvVolume As String = drv.VolumeLabel
                ' Dim drvSpaceAvailable As String = ShowTotalFileSize(drv.AvailableFreeSpace)
                If ListBox1.Items.IndexOf(drv.Name) = -1 Then
                    If ListBox2.Items.IndexOf(drv.Name) = -1 Then
                        MsgBox(drv.Name & " has been detected.", MsgBoxStyle.Information, "New Drive")
                        ListBox2.Items.Add(drv.Name)
                    End If
                End If
            End If
        Next



But it doesn't show the name of the drive... only the driveletter like G:\, how can i identify each drive? Like it's name or something... ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>