简体   繁体   English

如何在VB.Net中过滤打开的文件对话框

[英]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: 我想列出我在谷歌上找到的所有文件EXCLUDING * JAR和* JAVA示例:

 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). 如果文件类型以xxxxx结尾(您想要排除的是什么),您可以稍后添加代码以不处理某些内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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