I think you use a single instance of TPlayer class.
You defined an array of 1000 TPlayer objects, so you have to create 1000 TPlayer instances, then assign them to the array:
for i:=1 to 1000 do
begin
Player := TPlayer.Create;
with player do
begin
FCode:= StrToInt(CodeLabel.Caption
FName:= NameEdit.Text;
end;
Players[i]:=Player;
end;
now you have an array with 1000 TPlayer objects and an object (Player) which points to Players[1000].
In order to avoid any problems:
Player := nil;
Main Topics
Browse All Topics





by: akaSurrealPosted on 2003-04-28 at 13:13:50ID: 8415193
I don't see anything obviously wrong with this code you have listed. I suspect its a problem you have elsewhere. By the way, you could save yourself a step by changing your "with" to
with Players[i] do
your same code..
end;
This way you will not have to assign the
Players[i] := Player
or even have a need for that variable.
Mike