|
-
Aug 28th, 2007, 04:41 AM
#1
Thread Starter
New Member
Sorting Files
i want to sort files by what is actually in the files rather than just by their name. I have the following which sorts them by their name:
Code:
Private Sub SortFilesAzimuth()
Dim flbs(FilesLB.Items.Count - 1) As FileListBoxItem
FilesLB.Items.CopyTo(flbs, 0)
Dim dt As New DataTable()
dt.Columns.Add(New DataColumn("OrigIndex", System.Type.GetType("System.Int32")))
dt.Columns.Add(New DataColumn("FileIndex", System.Type.GetType("System.Int32")))
For i As Integer = 0 To flbs.Length - 1
Dim r As DataRow = dt.NewRow
r("OrigIndex") = i
r("FileIndex") = flbs(i).Index
dt.Rows.Add(r)
Next
Dim dv As New DataView(dt)
dv.Sort = "FileIndex ASC"
For i As Integer = 0 To dv.Count - 1
Dim flb As FileListBoxItem = flbs(CType(dv(i)("OrigIndex"), Integer))
Me.FilesLB.Items.Remove(flb)
Me.FilesLB.Items.Insert(i, flb)
Next
End Sub
I have numbers in the files I want to sort them by and not by the name of the file. Can anyone give me any suggestions?
Thanks
-
Aug 28th, 2007, 04:43 AM
#2
-
Aug 28th, 2007, 04:45 AM
#3
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|