Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
Fragenlist : TStringlist;
RbAntw : Array[0..4] of TRadioButton;
ii : Integer;
begin
For ii := Low(RbAntw) to High(RbAntw) do
RbAntw[ii] := TRadioButton.Create(Form1);
Fragenlist := TStringList.Create;
Fragenlist.LoadFromFile('C:\Fragen.txt');
Fragenlist.SaveToFile('C:\Fragen2.txt');
try
RbAntw[0].Caption := 'A';
RbAntw[1].Caption := 'B';
RbAntw[2].Caption := 'C';
RbAntw[3].Caption := 'D';
RbAntw[4].Caption := Fragenlist.Strings[6];
finally
Fragenlist.Free;
For ii := Low(RbAntw) to High(RbAntw) do
(RbAntw[ii] as TRadioButton).Free;
end;
end;
Funktioniert einwandfrei...