Hi,
I have a TListView with an OnCustomDrawItem event. Visibility of Column 9 is set to false. This column is used as a flag in the OnCustomDrawItem event which looks like this:
In one part of the form that fills the listview with data this is working fine.
But now I am working on a different part that uses a similar approach to fill the listview with data and now I get the error:
List index out of bounds[9]
I double checked and I am sure that the procedure to fill the listview is similar to the one that is working. I don't understand why I get the error?
procedure add items to listview:
Any ideas why I get the error now?
Thanks,
Raoul
I have a TListView with an OnCustomDrawItem event. Visibility of Column 9 is set to false. This column is used as a flag in the OnCustomDrawItem event which looks like this:
Code:
procedure TEmailClientForm.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if Item.SubItems.Strings[9] = '0' then
lvHeaders.Canvas.Font.Style := [fsBold]
else
lvHeaders.Canvas.Font.Style := [];
end;
In one part of the form that fills the listview with data this is working fine.
But now I am working on a different part that uses a similar approach to fill the listview with data and now I get the error:
List index out of bounds[9]
I double checked and I am sure that the procedure to fill the listview is similar to the one that is working. I don't understand why I get the error?
procedure add items to listview:
Code:
itm := ListView1.Items.Add;
itm.ImageIndex := -1;
itm.Caption := '';
itm.SubItems.Add('FieldByName('Name').Value');
itm.SubItems.Add('FieldByName('Address').Value');
itm.SubItems.Add('FieldByName('Postcode').Value');
etc...
Any ideas why I get the error now?
Thanks,
Raoul