Autor Beitrag
FSS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: So 04.06.06 21:44 
Hallo,

ich habe da mal wieder ein Problem, das vermutlich ganz einfach zu lösen ist.
Das Programm soll einen Wert, der in ein Edit eingegeben wird mit einem Wert, welcher in einem Label steht vergleichen.
Ist der Wert im Edit kleiner als der Wert im Label, soll das Programm eine bestimmte Aktion durchführen, und wenn er größer ist eine andere Aktion durchfüheren.
Ich bräuchte also eine If-Anweisung
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
if Edit1.Text (*größer als*) Label1.Caption then
  begin
    ...
end else if Edit1.Text (*kleiner als*) Label1.Caption then
  begin
    ...
  end;


Weiß jemand wie das geht?

FSS

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: So 04.06.06 21:48 
du kannst doch die zeichen < oder > nutzen
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 04.06.06 21:49 
Also prinzipiell so:
ausblenden Delphi-Quelltext
1:
if StrToInt(Edit1.Text) > StrToInt(Label1.Caption) then					

Das Problem ist nur, da0 du sicherstellen mußt das im edit nur sinnvolle Werte eingegeben werden können, also ab besten ein MaskedEdit nehmen.

_________________
Markus Kinzler.
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: So 04.06.06 22:01 
Ok, jetzt funktioniert es, danke für eure Hilfe.

FSS