Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Nur das größte Ergebnis wird angegeben (Rechner mit Checkbox und Radiobox) (https://www.delphipraxis.net/172994-nur-das-groesste-ergebnis-wird-angegeben-rechner-mit-checkbox-und-radiobox.html)

musicman56 2. Feb 2013 17:36

AW: Nur das größte Ergebnis wird angegeben (Rechner mit Checkbox und Radiobox)
 
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.


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:08 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz