RECONHECER PEN-DRIVE VB.NET
Preciso reconhecer qdo o pen-drive foi plugado e a unidade e armanezar em uma variavel texto.
Não testei, mas segue um fonte que encontrei na web.
Imports System.Reflection
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[ô] Find the first removable storage device and make this the initial
[ô] directory if it exists
Dim allDrives() As IO.DriveInfo = IO.DriveInfo.GetDrives()
Dim d As IO.DriveInfo
For Each d In allDrives
If d.IsReady = True AndAlso d.DriveType = IO.DriveType.Removable Then
ListBox1.Items.Add(d.VolumeLabel).ToString()
If IO.DriveType.Removable Then
TextBox1.Text = d.AvailableFreeSpace
End If
Else
If d.IsReady = True And Not d.DriveType = DriveType.Removable Then
ListBox1.Items.Add(d.RootDirectory).ToString()
TextBox1.Text = d.AvailableFreeSpace
End If
End If
Next
End Sub
End Class
Tópico encerrado , respostas não são mais permitidas