3
Reply

GetLogicalDrives issue

steve d

steve d

Oct 30 2007 5:03 PM
3.4k
I want to only add optical drives to my combo box
but currently my code adds all drives

my code:
 Function GetLogicalDrives()
        Dim returnValue As String()
        returnValue = Directory.GetLogicalDrives
        Try
            Dim drives As String()
            drives = System.IO.Directory.GetLogicalDrives()
            Dim str As String
            For Each str In drives
                ComboBox_cd_drive.Items.Add(str)
            Next str
        Catch exp As System.IO.IOException
            System.Console.WriteLine("An I/O error occurs.")
        Catch exp As System.Security.SecurityException
            System.Console.WriteLine("The caller does not have the " + _
                                       "required permission.")
        End Try
    End Function

Please help me out and thank you in advance

Answers (3)