I solved my problem but I need to know why this problem raised to me ?!
I write a project that load file to listBox then delete the strings one by one,
but w
Each time you delete an item from the list, the list contains one less item. However, the for statement copies the list count at the beginning, and is not updated upon each iteration. Therefore, by the time you get halfway through the list, the counter i becomes larger than the current (new) list count, even though the list no longer contains the original number of items.
As an alternative, you could also do a loop like this:
while ListBox3.Items.Count > 0 do begin
ShowMessage(ListBox3.Items[0]);
ListBox3.items.Delete(0);
end;