문제

I have used the filter method of openFileDialogBox to allow multiple file types to be opened, but the user must select which file type they want using the dropdown. Only files with extensions matching the selected file type are visible.

How can I show all files with extensions that match any of my allowed file types? I don't want all files to be visible/openable, just the ones that I have designated.

도움이 되었습니까?

해결책

Just specify what you want to allow... Just an example...

 Dim dlg As New OpenFileDialog()

 'Filter by Office Files
 dlg.Filter = "Office Files|*.doc;*.xls;*.ppt"

 dlg.ShowDialog()

다른 팁

A small snippet of how it works

Dim result As DialogResult = New DialogResult()
        OpenFileDialog1.Filter = "Word Documents|*.doc;*.docx|PowerPoint Slides|*.ppt|Video Files|*.MP4|PDF Files|*.pdf"
        OpenFileDialog1.InitialDirectory = "C:\"
        OpenFileDialog1.FileName = ""
        result = OpenFileDialog1.ShowDialog()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top