Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenFileDialog filter refresh

Status
Not open for further replies.

ZenRaven

Programmer
Mar 13, 2007
84
US
I've got the following code for multi-file selection:

Code:
        Dim localFiles() As String
        Dim localFile As String
        Dim listForEnumerator As ArrayList
        Dim OFD As New OpenFileDialog

        listForEnumerator = New ArrayList()

        Try
            With OFD
                .Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*"
                .Multiselect = True
                If .ShowDialog = DialogResult.OK Then localFiles = .FileNames
                If IsNothing(localFiles) Then Exit Sub
                For Each localFile In localFiles
                    listForEnumerator.Add(localFile)
                Next
            End With
        Catch
        End Try

Everything works fine except when I select a different filter. If I select either *.xls or *.* from the list of filters, the folder/file list goes blank. I can get it to refresh the list if I click on one of the system folders listed on the left of the dialog box but that is the only way. Has anyone seen this? Any suggestions?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top