Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Folders and files question 3

Status
Not open for further replies.

shannanl

IS-IT--Management
Apr 24, 2003
1,071
US
Is there a way to read a directory into Visual Basic and populate a list box, combo box or data grid or something like that with the folder or file names in the directory? For example a directory that is called Patients. Inside the folder would be a file for each patient. Can I display those file names in a list box, etc? Also if this can be done can you somehow click on one of the items in the list box and have VB open what it corresponds to?

Thanks in advance.

Shannan
 
The DriveListBox and DirListBox standard controls ( on the Toolbox ) will do it but I don't think they will automatically open a selected file.
 
All the functionality for this is provided pre-packaged in the DriveListBox, DirListBox and FileListBox Controls. Select "Project / Components" and check "Microsoft Common Controls 6.0" (MSCOMCTL.OCX) in the IDE and then drop whichever of the controls you need on your form. Check HELP for a description of the properties and methods that you can use to work with these controls.
 
To open the files do a search on this forum for ShellExecute. There is also a full example at:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks for the help guys.

Shannan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top