Autor Beitrag
boozzz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66

Win XP, Win 2000, SuSe Linux

BeitragVerfasst: Mi 13.04.05 13:29 
HI
ich hätte eine einfache Frage zur Ein- und Ausgabe eines Wertes in Delphi.
ich möchte z.B. eine Zahl in mein Programm eingeben, und in die Variable Q speichern. Hierzu hab ich ein Textfeld erstellt (edit) und einen Button. Was schreibe ich in den Button hinein?

Zur Ausgabe: Wie kann ich diese Variable Q wieder in ein anderes Textfeld ausgeben? Was für ein Textfeld ist am geschicktesten (edit, listbox...)?

vielen Dank schon mal
boozzz

:oops:
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 13.04.05 13:38 
Von was für einem Typ ist denn Q? Integer, String? Wenn's ein String ist, dann so:
ausblenden Delphi-Quelltext
1:
Q := Edit1.Text;					

Bei Integer:
ausblenden Delphi-Quelltext
1:
Q := StrToInt(Edit1.Text);					
boozzz Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66

Win XP, Win 2000, SuSe Linux

BeitragVerfasst: Mi 13.04.05 13:40 
Q ist ein Integer. Aber was is eigentlich der Unterschied zwischen String und Integer?
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 13.04.05 13:41 
Grob gesagt: String ist für Text und Integer für ganze Zahlen. ;)
boozzz Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66

Win XP, Win 2000, SuSe Linux

BeitragVerfasst: Mi 13.04.05 13:43 
Vielen vielen Dank
Könntest du mir noch sagen, wie ich dieses Q schließlich in ein anderes Textfeld ausgeben kann?
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 13.04.05 13:45 
Achso. Ja, stimmt. Ich les wieder nur die Hälfte... :D

Ganz ähnlich:
ausblenden Delphi-Quelltext
1:
Edit1.Text := IntToStr(Q);					

...oder bei ListBox (was ich aber nicht empfehlen würde:
ausblenden Delphi-Quelltext
1:
ListBox1.Items.Add(IntToStr(Q));					
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 13.04.05 13:45 
ausblenden Delphi-Quelltext
1:
edit2.text := IntTOStr(Q);					

_________________
mfg. Joel