chillywinter
Programmer
I want to reset all my check box's to unticked. I can do it with the following code but is there a short hand way to code this using a FOR statement:
procedure TForm1.Button1Click(Sender: TObject);
begin
checkbox1.checked := false;
checkbox2.checked := false;
checkbox3.checked := false;
checkbox4.checked := false;
checkbox5.checked := false;
end;
The following doesn't work:
procedure TForm1.Button1Click(Sender: TObject);
var
I : integer;
begin
for I := 1 to 5 do Tcheckbox(I).checked := false;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
checkbox1.checked := false;
checkbox2.checked := false;
checkbox3.checked := false;
checkbox4.checked := false;
checkbox5.checked := false;
end;
The following doesn't work:
procedure TForm1.Button1Click(Sender: TObject);
var
I : integer;
begin
for I := 1 to 5 do Tcheckbox(I).checked := false;
end;