Jump to content

Sorting Folders by Date in a listview object

- - - - -

  • Please log in to reply
No replies to this topic

#1
Sharper_Software

Sharper_Software

    Newbie

  • Members
  • PipPip
  • 17 posts
hey guys i am trying to make an app that will allow to index a directory and give the user a list of all the directory and when they were last updated/used.

So far i have this

 Dim files As ReadOnlyCollection(Of String)
        files = My.Computer.FileSystem.GetDirectories("C:\Users\jaredw\Downloads", FileIO.SearchOption.SearchTopLevelOnly)
'get all the directories in the search folder
        For Each folder In files
            Dim fileData As DirectoryInfo = My.Computer.FileSystem.GetDirectoryInfo(folder)
            ListView1.Items.Add(fileData.LastWriteTime.ToString, 0).SubItems.Add(fileData.Name)
'create a group for the date and add each item if it has the same date in the same group
            ListView1.Groups.Add(New ListViewGroup(fileData.LastWriteTime.Date.ToString, HorizontalAlignment.Left))
            ListView1.Items.Item(0).Group = ListView1.Groups(0)

        Next
'sort the list afterwards
        ListView1.Sorting = SortOrder.Descending
        ListView1.Sort()

now, i cant get it to sort and it frezzes the form sometimes for large searches, i am thinking of putting in a progress bar maybe or a multi thread but then how do i return the results to a hanndle other then the one it was created on?

I appreciate any help/advise




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users