Destop in Drive control

Posted on 2005-04-19
Last Modified: 2010-05-02
How to include desktop item in the drive control.
It displays only the drives c,d,e etc.
I want the drive control to act similar to the  "Look in" in vb file open dialog.

Question by:krisrajz
    LVL 1

    Expert Comment

    As far as i know you cant get the desktop item in the drive control how ever if you add a reference to you project to Windows Scripting Runtime, you can access the file system object and loop through the available drives appending them to a combo box, or image combo along with an icon.

        Dim FSO As New FileSystemObject
        Dim Drv As Drive
        For Each Drv In FSO.Drives
            Select Case Drv.DriveType
                Case CDRom
                    'Add to combo
                Case Fixed
                    'Add to combo
            End Select

    Hope this helps
    LVL 1

    Expert Comment


    You can then add custom items that can point any where all you would have to add an a combo_click event with code to redirect you folder window.

    c:\Documents and Settings\Username\Desktop
    for the desktop.
    LVL 6

    Accepted Solution

    use a BrowseForFolder instead:

    it opens an explorer-like tree. if you have winamp, open the playlist editor and choose ADD DIR, the window that appears is a browseforfolder

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now