Peter Kiers
asked on
Find a device connected to a usb-port
Hi,
I have device connected to a usb-port, that you see in the picture.
I have some code to detect the name of the device but its not working
The code doesn't detect the device.
I get an IOExecption with a message:
"Device not ready"
Who knows the answer and is willing to help me?
Peter Kiers
I have device connected to a usb-port, that you see in the picture.
I have some code to detect the name of the device but its not working
The code doesn't detect the device.
I get an IOExecption with a message:
"Device not ready"
Who knows the answer and is willing to help me?
Peter Kiers
private void button1_Click(object sender, EventArgs e)
{
foreach (System.IO.DriveInfo di in System.IO.DriveInfo.GetDrives())
{
if (di.VolumeLabel.Equals("SmartPix", StringComparison.InvariantCultureIgnoreCase))
{
MessageBox.Show("Device found");
if (System.IO.Directory.GetFiles(@"\REPORT\XML", "G*.xml").Length > 0)
{
MessageBox.Show("File found");
}
}
}
}
Example1.jpg
ASKER
Can you give me a little example how to find the device called SmartPix.
Peter
Peter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanx.P
Great, wish you good luck ans thank you.
In order to exclude it you can just use
Open in new window
Open in new window
Also you can exclude other unwanted drive types that are in DriveType list.