My PC has 3 drives C, D, E...when I insert the removable CD drive it should detect that the drive is the F:...
it may vary for different systems...how can I find which will can be the CD drive...
I had written the following code
Try
For Each drive In DriveInfo.GetDrives()
If drive.DriveType = DriveType.CDRom Then
MessageBox.Show(drive.ToString())
CD_Targetpath = drive.ToString
Else
MessageBox.Show("CD drive does not exist")
Exit Sub
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
But as soon as it detects any other drive it exits from the sub