My form has two listboxes. Both display filenames after a search of the drive (*.avi). However, i put in a function that strips the path from one listbox(the one the user will see).
Here is the Form_Load.
Private Sub Form_Load()
Dim strFind() As String
Dim lngFound As Long
Dim lngCount As Long
Set objFind = New clsFileFinder
lngFound = objFind.LocateFileLocally("*.avi", strFind)
If objFind.blnFindAbort Then
For lngCount = 0 To lngFound - 1
List1.AddItem sGetFileName(strFind(lngCount)) 'no path
List2.AddItem (strFind(lngCount)) 'path included
List1.ItemData(List1.NewIndex) = List2.NewIndex 'line from mcrider
Set objFind = Nothing
Function sGetFileName(sFullPath As String) As String
Dim i As Integer
For i = Len(sFullPath) To 1 Step -1
If (Mid$(sFullPath, i, 1) = "\") Then Exit For
sGetFileName = Mid$(sFullPath, i + 1)
This works awesome!!! Until,
I set the .Sorted Property to True on one or two listboxes. Then they don't stay in synch.
mcrider gave me the .NewIndex line but it still doesn't work.
What am i doing wrong?
see Q.10227083 for the history of this question if you want to.
Experts: Please don't answer this question until i can verify that it works properly through your comments.(feel kinda funny rejecting an answer after you spent some time on it.:))