简体   繁体   中英

how to filter open file dialog in 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

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM