I’m missing something here, and not quite sure what it is.
Originally I had a thread that in the run phase was getting a list of files from a folder and passing them to a dictionary for processing by the UserInterfaceUpdate event, and it worked when I was processing just the filename.
But I’ve tried passing in several other pieces of information into the dictionary (size and date) and now I am only receiving the first file repeatedly
When I was just doing the filename I was getting each and every one of them, now that I am trying to pass more info, I am repeatedly passing the first one over and over.
I know it’s my application of using the Dictionary Object, I’m just not sure what I’m doing wrong.
When I was doing it with just the filename I was passing just "name":file.name
but now I’m trying to pass a complete dictionary (htis is where I’m going wrong).
This is my “Run” event:
Var file As FolderItem
Var folder As FolderItem = searchFolder
Var fileCount As Integer = folder.Count
Var D As New Dictionary
For i As Integer = 0 To fileCount-1
file = folder.ChildAt(i)
If file <> Nil Then
D.Value("name") = file.Name
D.Value("date") = file.CreationDate
D.Value("size") = file.Length
Thread1.AddUserInterfaceUpdate(D)
End If
Next
and this is my update event:
Var i As Integer
For Each entry As Dictionary In data
i = lb.RowCount
lb.AddRow(i.ToString)
lb.CellValueAt(lb.LastAddedRowIndex, hcFileName) = entry.Value("name").StringValue
lb.CellValueAt(lb.LastAddedRowIndex, hcDate) = entry.Value("date").StringValue
lb.CellValueAt(lb.LastAddedRowIndex, hcSize) = entry.Value("size").StringValue
window1.Title=lb.RowCount.ToString
Next
I feel like I’m missing something pretty basic.
I no longer have the code, but when I was processing JUST the filename, I hadn’t declared a dictionary and I was simply passing in “file”:file.name so the code was more like (from memory):
For i As Integer = 0 To fileCount-1
file = folder.ChildAt(i)
If file <> Nil Then
Thread1.AddUserInterfaceUpdate("file":file.name)
End If
Next
and then in the update event I simply added it to the listbox, but now I want to process multiple items at once