Visual Basic Concepts
The file list box displays files contained in the directory specified by the Path property at run time. You can display all the files in the current directory on the current drive using the following statement:
File1.Path = Dir1.Path
You can then display a subset of these files by setting the Pattern property — for example, *.frm displays only files with that extension. The Pattern property can also accept a list delimited by semicolons. For example, a line with the following code displays all files with the extensions .frm and .bas:
File1.Pattern = "*.frm; *.bas"
Visual Basic supports the ? wildcard character. For instance, ???.txt displays files that have base names of only three characters with the extension .txt.
Working with File Attributes
The attributes of the currently selected file (Archive, Normal, System, Hidden, and ReadOnly) are also available through file list box properties. You use these properties to specify which kinds of files to display in a file list box. The default value for the System and Hidden attributes is False. The default value for the Normal, Archive, and ReadOnly attributes is True.
To display only read-only files in the list box, for example, simply set the ReadOnly property to True and the other attribute properties to False:
File1.ReadOnly = True File1.Archive = False File1.Normal = False File1.System = False File1.Hidden = False
When Normal = True, those files without the System or Hidden attribute are displayed. When Normal = False, you can still display files with ReadOnly and/or Archive attributes by setting these attributes to True.
Note You cannot use the attribute properties to set file attributes. To set file attributes, use the SetAttr statement.
By default, you can highlight only a single selection in a file list box. To select multiple files, use the MultiSelect property.
For More Information For more information on SetAttr, see "SetAttr Statement." Also see "MultiSelect Property."