Hi,

I'd like to be able to retrieve the available drives on a local machine using DriveInfo and place that data into a control so that the user can select a drive to work on.

Can anyone please suggest a good control to use and some suitable code?

Thanks

David

Recommended Answers

All 2 Replies

From my point of view, TreeView and LIstView are most suitable for your job.
You can use any one or both.

You can enumerate the drives as follows:

Dim drives() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives()

For Each drive In drives
    lbxDrives.Items.Add("Name:  " & drive.Name)
Next

Note that there are other properties (DriveFormat, DriveType, VolumeLabel, etc.) that will throw an exception if you try to access them if the drive is not available (for example if you do not have a CD inserted).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.