News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

Let the user select mutliple files in Visual Basic 2005

Started by nandagopal, Nov 17, 2008, 07:08 PM

Previous topic - Next topic

nandagopal

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