How to: Add Visual Basic 6.0 File System Controls to Your Application

We recommend that you use the OpenFileDialog and SaveFileDialog components to provide access to the file system; however, if you find it necessary to create your own file dialog boxes, Visual Basic 2008 provides DirListBox, DriveListBox, and FileListBox controls as part of the Microsoft Visual Basic Compatibility Runtime library.

You can add a DirListBox, DriveListBox, or FileListBox to a Windows Application project using the following procedures.


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Adding Controls to Your Project

To add a reference to the Compatibility library

  1. On the Project menu, choose Add Reference.

  2. In the Add Reference dialog box, click the .NET tab. Under the Component Name list, choose Microsoft.VisualBasic.Compatibility, and then click OK.

    A reference will be added to your project.

To add the controls to the Toolbox

  1. On the View menu, choose Toolbox.

  2. Expand the All Windows Forms section. Right-click its title bar and then click Choose Items.

  3. In the Choose Toolbox Items dialog box, check the DirListBox, DriveListBox, and FileListBox components, and then click OK.

    The controls will be added to the Toolbox; they can be used like any other Windows Forms control.


    Once added, the controls will remain in the Toolbox until you explicitly remove them.

See Also


DirListBox Control for Visual Basic 6.0 Users

DriveListBox Control for Visual Basic 6.0 Users

FileListBox Control for Visual Basic 6.0 Users


OpenFileDialog Component Overview (Windows Forms)

SaveFileDialog Component Overview (Windows Forms)