Hai,
wenn eh ein Array da ist kann ich dort doch auch gleich die Werte und die Labels ablegen.
Delphi-Quellcode:
type
TCounterRecord = record
Counter: Integer;
CounterLabel: TLabel;
end;
var
CounterArray: array[1..10] of TCounterRecord;
procedure TDemoForm.btn_testClick(Sender: TObject);
var
ndx: Integer;
begin
for ndx := Low(CounterArray) to High(CounterArray) do
begin
with CounterArray[ndx] do
begin
CounterLabel.Caption := IntToStr(CounterArray[ndx].Counter);
end;
end;
end;
procedure TDemoForm.FormCreate(Sender: TObject);
var
ndx: Integer;
begin
CounterArray[1].CounterLabel := Label1;
CounterArray[2].CounterLabel := Label2;
CounterArray[3].CounterLabel := Label3;
CounterArray[4].CounterLabel := Label4;
CounterArray[5].CounterLabel := Label5;
CounterArray[6].CounterLabel := Label6;
CounterArray[7].CounterLabel := Label7;
CounterArray[8].CounterLabel := Label8;
CounterArray[9].CounterLabel := Label9;
CounterArray[10].CounterLabel := Label10;
for ndx := 1 to 10 do
CounterArray[ndx].Counter := ndx;
end;
Stephan B.