我正在使用以下代码获取计算机上每个驱动器的字母列表。我想从此列表中获取 CD 驱动器的驱动器号。我该如何检查?
我用来获取列表的代码如下:
在Form.Load
事件中:
cmbDrives.DropDownStyle = ComboBoxStyle.DropDownList
Dim sDrive As String, sDrives() As String
sDrives = ListAllDrives()
For Each sDrive In sDrives
Next
cmbDrives.Items.AddRange(ListAllDrives())
. . .
Public Function ListAllDrives() As String()
Dim arDrives() As String
arDrives = IO.Directory.GetLogicalDrives()
Return arDrives
End Function