|
|
Title | Let the user select mutliple files in Visual Basic 2005 |
Description | This example shows how to let the user select mutliple files in Visual Basic 2005. |
Keywords | files, select files, multiple files, open file dialog, OpenFileDialog, Visual Basic 2005 |
Categories | Files and Directories, Controls |
|
|
When the user clicks the program's Pick Files button, the following code displays an OpenFileDialog. If the user selects files and clicks OK, the program loops through the dialog's FileNames collection, adding each file's name to the form's ListBox.
|
|
Private Sub btnPickFiles_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnPickFiles.Click
lstFiles.Items.Clear()
If ofdFiles.ShowDialog() = _
Windows.Forms.DialogResult.OK Then
For Each file_name As String In ofdFiles.FileNames
lstFiles.Items.Add(file_name)
Next file_name
End If
End Sub
|
|
|
|
|
|