Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleLet the user select mutliple files in Visual Basic 2005
DescriptionThis example shows how to let the user select mutliple files in Visual Basic 2005.
Keywordsfiles, select files, multiple files, open file dialog, OpenFileDialog, Visual Basic 2005
CategoriesFiles 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated