Einzelnen Beitrag anzeigen

omega
(Gast)

n/a Beiträge
 
#5

Re: Summe von Editfelder für Addition

  Alt 23. Okt 2004, 17:17
Jo danker erstmal! Habe nun aber folgende längere Variante geschrieben:

Delphi-Quellcode:
if edit8.text <> 'then begin
Summe:=strtoint(edit8.text); end;
if edit7.text <> 'then begin
Summe:=strtoint(edit7.text)*10+strtoint(edit8.text); end;
if edit6.text <> 'then begin
Summe:=strtoint(edit6.text)*100+strtoint(edit7.text)*10+strtoint(edit8.text); end;
if edit5.text <> 'then begin
Summe:=strtoint(edit5.text)*1000+strtoint(edit6.text)*100+strtoint(edit7.text)*10+strtoint(edit8.text);
end;
if edit4.text <> 'then begin
Summe:=strtoint(edit4.text)*10000+strtoint(edit5.text)*1000+strtoint(edit6.text)*100+strtoint(edit7.text)*10+strtoint(edit8.text);
end;
 if ergebnis > 9 then begin
  if edit8.modified then edit8.setfocus;
  end;
 if ergebnis > 99 then begin
  if edit8.modified then edit7.setfocus;
  if edit7.modified then edit6.setfocus;
  end;
 if ergebnis > 999 then begin
  if edit8.modified then edit7.setfocus;
  if edit7.modified then edit6.setfocus;
  if edit6.modified then edit5.setfocus;
  end;
 if ergebnis > 9999 then begin
  if edit8.modified then edit7.setfocus;
  if edit7.modified then edit6.setfocus;
  if edit6.modified then edit5.setfocus;
  if edit5.modified then edit4.setfocus;
  end;
 if Summe = (strtoint(edit2.text) + strtoint(edit3.text)) then
 begin
 edit1.text := 'Richtig!'; button1.enabled:=true; end;
[edit=sakura] FAQ-Eintrag zum Stichwort "9""9" Mfg, sakura[/edit]
  Mit Zitat antworten Zitat