Hi
I am not aware of any inbuit method other than using a SortedDictionary. Here is an example. I used a Function which helps if you need to reuse at other places. To prove the sort, you can manually reorder the testnames to mix them up differently.
Public Class Form1
' this to simulate file naames from
' HDD. Manually mixed up to prove
' the sort.
Dim testnames() As String = {"icon101", "icon2", "icon99", "icon10", "icon1", "icon11", "icon100", "icon1000"}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With ListBox1
.DataSource = New BindingSource(GetFls, Nothing)
.DisplayMember = "value"
End With
End Sub
Function GetFls() As SortedDictionary(Of Integer, String)
Dim dic As New SortedDictionary(Of Integer, String)
' You would read the names as
' usual into a string array
' sorting unecessary.
' Dim testnames() As String = IO.Directory.GetFiles(strClosetPath, "*.png")
For Each s As String In testnames
dic.Add(CInt(s.Replace("icon", Nothing)), s)
Next
Return dic
End Function
End Class