Adding filters to the Open File dialog and Selecting Multiple Files

This sample VB.net code snippet shows how to add filters to the Open File dialog and Selecting Multiple Files.


OpenFileDialog1.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mid;*.wav;*.mp2;*.mp3|All Files|*.*"

OpenFileDialog1.FilterIndex = 1
OpenFileDialog1.InitialDirectory = "C:\"
OpenFileDialog1.Title = "Open File"
If (OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
If (OpenFileDialog1.FileNames.Length > 0) Then
' Make sure the User selected one or more files
For Each strFileName As String In OpenFileDialog1.FileNames
List1.Items.Add(strFileName)
' Loop through the list of selected filenames and add each one to your listbox
Next
End If
End If


Comments

Guest Author: rajni25 Apr 2012

Please send me full code with design and how to design it.thank

Guest Author: rajni25 Apr 2012

plz send me full code with design ........and how to design it...thnx



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: