Hello all!
I've a program in which I list all the directories, Then, all the files within those directories. I have a list view, and I must load files with multiple file extensions into it. Let me explain better:
Say for example I want to list files with either a .dot or a .doc extension into the listview.
This loads the dirs & the Files :
I tried makig a String variable that looks like :Code:Private Sub SSLoadDir(ByVal SSDirList As String) Try For Each SSFolderList As String In Directory.GetDirectories(SSDirList) Dim SubFolderList As String = lstSSDir.Items.Add(SSFolderList) Next Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub SSLoadFile() Dim SSFolder As String = CStr(SSDir) If Not SSFolder Is Nothing AndAlso IO.Directory.Exists(SSFolder) Then For Each SSFile As String In IO.Directory.GetFiles(SSFolder) Dim SSTempExt As String = IO.Path.GetExtension(SSFile) Dim SSDateMod As String = IO.File.GetLastWriteTime(SSFile).ToString() Dim SSDateCreate As String = IO.File.GetCreationTime(SSFile).ToString() If SSTempExt = SSFilExt Then 'THIS Fails Dim SSItem1 As New ListViewItem(SSFile.ToString()) SSItem1.SubItems.Add(SSDateCreate.ToString()) SSItem1.SubItems.Add(SSDateMod.ToString()) lvSSFiles.Items.AddRange(New ListViewItem() {SSItem1}) 'add everything End If Next End If End Sub
Once the files are loaded into the listview, I'll need to open the associated program.Code:FilExt = "*.doc;*.dot"
I just want to know if I can set up a "filter" and load ONLY those files within the filter, into the listview?




Reply With Quote