Autor Beitrag
death-adders
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 82

Vista
Turbo Delphi Explorer
BeitragVerfasst: Di 16.05.06 18:52 
hi! kann mir jemand sagen, wei ich mit den befehlen strtofloat und floattostr umzugehen hbae, bzw, was für eine funktion sie eigentlich haben.

warum geht nicht einfach

ausblenden Delphi-Quelltext
1:
 variable1:=edit1.text;					


??? wie muss es warum richtig heißen?

danke für die hilfe!
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 16.05.06 18:55 
im titel schreibst du doch die funktionen, also wo ist das problem?

StrToFloat/FloatToStr sind funktionen die einen Parameter erwarten. FloatToStr einen Float-Wert (Real/Dowble/Extended...) und StrToFloat einen String-Wert ('3.43245')

Also Edit1.Text := FloatToStr(MEineVariable)


greetz


EDIT: Nächstes mal einfach mal Hinter eine Funktion 'ne Klammer setzen, dann solltest du sehen welche Parameter benötigt werden ;)

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
death-adders Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 82

Vista
Turbo Delphi Explorer
BeitragVerfasst: Di 16.05.06 19:06 
nein, also x:=edit1.text; geht ja nicht

aber

ausblenden Delphi-Quelltext
1:
x:=strtofloat(edtit1.text);					


geht!

Also ein sring ist dann also sozusagen eine "Zahl" und weil ja im edit1 ein text steht muss er es noch in eine zahlö umwandeln, stimmt das so?!?


wie sieht das denn dann umgekehrt aus? wenn ich in das edit1 den inhalt einer variable machen will?
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 16.05.06 19:17 
Das was im Edit steht ist eine Zeichenkette. Ist doch logisch wie es anders herum geht

EditText := FloatToStr(x) :roll:

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
death-adders Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 82

Vista
Turbo Delphi Explorer
BeitragVerfasst: Di 16.05.06 19:18 
OK dankeschön!

HAHA!! wieder schaluer! :-D