View Single Post
Old Jul 21st, 2006, 9:59 AM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
yeah, I was going to say that you could just use timers and keep checking for the new drive, but as you said, it's liked glued together:p Although, If you would like to make your code that you are making a little more effiecient, I would suggest using the Directory class. e.g:

something = Directory.GetLogicalDrives

If you want more code, here is some code I developed in C# for a guy who needed it and he converted it VB.NET. Perhaps it might be of some use to you. It gets the Names and Volume labels of the drives.

        Dim drives As String() = Directory.GetLogicalDrives
        For Each drive As String In drives
            Dim di As DriveInfo = New DriveInfo(drive)
            Dim newlst1 As ListViewItem
            newlst1 = lstdrives.Items.Add(0)

            Try
                newlst1.Text = (drive + " (" + di.VolumeLabel + ")")

            Catch ex As Exception
                newlst1.Text = (drive & "")
            End Try

        Next

Anyways, good luck
Booooze is offline   Reply With Quote