I have a wierd problem with a ListView in report mode.
Basically Im dragging and dropping Items from a TreeView into a ListView, which works without a problem.
I can save the listview contents to a file, Im using a simple ini type file.
I can re-load the contents of the file back into the listview without no trouble, All information is placed in columns correctly.
However..the code at the very bottom will only work if the listview contents were not loaded from a file, If I load contents from a file I get Index out of bounds message every time.
Heres the open from Ini type file code (Seems to work Fine)
Im trying to read info back from the ListView here. this code works if i do not load from a file.Code:IdCount2 = 0 M = 0 C = 0 Value = IniString("IconIndex 10", "List10 Count", OpenFileName) txtINI.Text = Value 'MsgBox txtINI If txtINI.Text = App.Path & "\" & OpenFileName Then GoTo IconIndex11 Exit Sub End If M = Value 'Icon Index 10 loop Do C = C + 1 IdCount2 = IdCount2 + 1 Value = IniString("IconIndex 10", "Item " & IdCount2, OpenFileName) txtINI.Text = Value With ListView1 .Icons = imgDirTree .ListItems.Add (C), "_10_" & txtINI, txtINI, , 10 .ListItems(C).SubItems(1) = "All *.* " Value = IniString("IconIndex 10", "Size " & IdCount2, OpenFileName) txtINI.Text = Value .ListItems(C).SubItems(2) = txtINI End With Loop Until C = M GoTo IconIndex11 Exit Sub
Does anybody know why this wont work after being reloaded from a file?Code:C = 0 M = frmBackUp.ListView1.ListItems.Count Do C = C + 1 With frmBackUp.ListView1.ListItems L = Left(.Item(C).Key, 4) 'grab the key and strip the 1st 4 chars to determine the Icon Numbers 'A few other grab info lines here. End With Loop Until C = M
No matter what I do the index is always out of bounds, even though the variable 'C' has the correct value (In This Case 1).
Thanks in advance for any help!




Reply With Quote