JSelf
2008-08-12, 02:03 PM
I am having an interesting problem filling a list box with the contents of an array. With the code below it only puts the last item in the array in the listbox. If I had for example 5 items in the list the first 4 would be blank and the 5th would be displayed as expected. Does anyone have any ideas as to what I am doing wrong?
DWGArrayCount = 1
For Each objFILE In objFLDR.Files
If InStr(1, objFILE.Name, ".dwg", vbTextCompare) > 0 Then
ReDim DWGArray(1 To DWGArrayCount)
CurrentDWG = objFILE.Name
DWGArrayString = Replace(CurrentDWG, ".dwg", "")
DWGArray(DWGArrayCount) = DWGArrayString
DWGArrayCount = DWGArrayCount + 1
End If
Next
For Each DWGName In DWGArray
TrayForm.ListBoxBlocks.AddItem DWGName
Next
TrayForm.ListBoxBlocks.ListIndex = 0
Thanks in advance,
Jason Self
DWGArrayCount = 1
For Each objFILE In objFLDR.Files
If InStr(1, objFILE.Name, ".dwg", vbTextCompare) > 0 Then
ReDim DWGArray(1 To DWGArrayCount)
CurrentDWG = objFILE.Name
DWGArrayString = Replace(CurrentDWG, ".dwg", "")
DWGArray(DWGArrayCount) = DWGArrayString
DWGArrayCount = DWGArrayCount + 1
End If
Next
For Each DWGName In DWGArray
TrayForm.ListBoxBlocks.AddItem DWGName
Next
TrayForm.ListBoxBlocks.ListIndex = 0
Thanks in advance,
Jason Self