TListItem
is a type. You must use a local variable of that type in the loop.
var
item: TListItem;
begin
for item in listView1.Items do
...
See Iteration Over Containers Using For statements
.
The type of the iteration variable Element must match the type held in the container. With each iteration of the loop, the iteration variable holds the current collection member. As with regular for-loops, the iteration variable must be declared within the same block as the for statement.
Warning: The iteration variable cannot be modified within the loop. This includes assignment and passing the variable to a var parameter of a procedure. Doing so results in a compile-time warning.
If you want to delete an item, you must pass a valid index.
listView1.Items.Delete(listView1.Items.IndexOf(item));
The TServerWinSocket.Connections
expects an integer index, so it seems as you have to convert the item to an index as showed above.
If your goal is to delete the disconnected object, and you do that by testing all items, you should iterate with a normal top down for loop instead.
for i := Pred(listView1.Items.Count) downto 0 do