You're not adding an item in each iteration in the for loop. When you skip for [.]
, you should get an AV for lvlistview.items[i]
in the next iteration, because the index of the item you just added is i-1
. To resolve, keep a reference to the item you add and work on it.
var
..
Item: TListItem;
begin
..
Item := lvListView.Items.Add;
Item.Caption := fileName;
Item.SubItems.Add(IntToStr(size));
Item.SubItems.Add(extention);
Item.ImageIndex := GetItemImage(fileName, extention);
..