Autor Beitrag
FF
Hält's aus hier
Beiträge: 13

Win XP
Delphi 7
BeitragVerfasst: Mi 18.10.06 18:58 
Hallo zusammen,
ich habe schon im forum gesucht aber nichts gefunden.
mein problem ist: ich möchte einen button machen, der
prüft ob die eingegebene zahl in einem editfeld positiv oder negativ ist.
dann kehrt er sie entsprechend um.
kann mir jemand helfen??

danke im voraus, ff


Moderiert von user profile iconGausi: Topic aus Dateizugriff verschoben am Mo 23.10.2006 um 11:53
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 18.10.06 19:01 
ausblenden Delphi-Quelltext
1:
if (strtoint(edit1.text) < 0 or strtoint(edit1.text) > 0) then edit1.text := inttostr(strtoint(edit1.text) * -1);					

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.10.06 19:01 
Moin!

Probier das mal so: ;)
ausblenden Delphi-Quelltext
1:
Edit1.Text := FloatToStr(StrToFloatDef(Edit1.Text,0) * -1);					

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
FF Threadstarter
Hält's aus hier
Beiträge: 13

Win XP
Delphi 7
BeitragVerfasst: Mi 18.10.06 19:04 
thx, aber er zeigt als fehlermeldung an "inkompatible typen"
FF Threadstarter
Hält's aus hier
Beiträge: 13

Win XP
Delphi 7
BeitragVerfasst: Mi 18.10.06 19:05 
Ahh, das von Narses funzt, thx!!!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.10.06 19:06 
Moin!

Dann wäre jetzt von dir mal etwas Code nötig... :roll: ;)

cu
Narses

//OK. ;)

_________________
There are 10 types of people - those who understand binary and those who don´t.