Delphi-Quellcode:
var
i:Integer;
sum:Double;
begin
sum := 0;
if RadioButton1.checked then
for I := 1 to 4 do
if TCheckBox(FindComponent('Checkbox' + IntToStr(i))).Checked
then Sum := Sum + StrToFloat(TEdit(FindComponent('Edit' + IntToStr(i))).Text);
Label7.Caption := FloatToStr(sum);
end;
Ich würde es lieber so machen, weil sonst Label7 eine "alte" Summe anzeigt, wenn keine Checkbox markiert ist.