Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to filter open file dialog in VB.Net

Tags:

vb.net

How do I filter file types in open - save file dialog with these types? I want to list all files EXCLUDING *JAR and *JAVA example I found on google:

 Using O As New OpenFileDialog With {.Filter = "(Image Files)|*.jpg;*.png;*.bmp;*.gif;*.ico|Jpg, | *.jpg|Png, | *.png|Bmp, | *.bmp|Gif, | *.gif|Ico | *.ico", .Multiselect = False, .Title = "Select Image"}
     If O.ShowDialog = 1 Then
         TextBox1.Text = O.FileName
     End If
End Using
like image 680
user2618553 Avatar asked Sep 02 '13 18:09

user2618553


2 Answers

hi you can try this code.

openFD.InitialDirectory = "C:\"
openFD.Title = "Open a Text File"
openFD.Filter = "Text Files|*.txt"
openFD.ShowDialog()

feel free to contact if get problem.

Regards.

like image 74
SMHasnain Avatar answered Sep 30 '22 02:09

SMHasnain


There no excluding option in those filters. You might add code later not to process something if its file type ends with xxxxx (whatver you want to exclude).

like image 26
user613326 Avatar answered Sep 30 '22 02:09

user613326