Autor Beitrag
TobiHH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

XP Pro und Vista Ultimate
Delphi 7
BeitragVerfasst: Fr 21.11.08 20:19 
Moin Moin

Ich hab beim Programmieren wohl wieder einen kleinen Denkfehler, bei anderen Fehlern hat mir die Suche schon richtig gut geholfen.

Ich möchte bei einer ComboxBox die Auswahl auslesen und diese dann in eine ListBox übertragen.

Typenbezeichnung:=StrToFloat(ComboBoxFahrzeugtyp.SelText);

So würde das ja eigentlich klappen, ich würde sagen das liegt am Datentyp, den ich in der Variablenliste festgelegt habe.
In der Schule haben wir eigentlich nur Real und Integer kennengelernt.

Gibt es extra einen Datentyp für Texte? Vielleicht kann mir ja jemand helfen.

Gruß Tobi


Zuletzt bearbeitet von TobiHH am Di 25.11.08 15:08, insgesamt 1-mal bearbeitet
wazap
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 25



BeitragVerfasst: Fr 21.11.08 20:28 
Aus dem Code kann ich mir nur eins vorstellen: Typenbezeichnung:=StrToFloat(ComboBoxFahrzeugtyp.Text); von welchem Type "Typenbezeichnung" und "ComboBoxFahrzeugtyp" ist hast du nicht angegeben!
TobiHH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

XP Pro und Vista Ultimate
Delphi 7
BeitragVerfasst: Fr 21.11.08 20:36 
Danke schonmal :D

Typenbezeichnung:=StrToFloat(ComboBoxFahrzeugtyp.Text);

da kommt jetzt zumindest keine Fehlermeldung mehr. :D
Hab die Variable Typenbezeichnung jetzt als Real deklariert.

So müsste das ja eigentlich sein, wenn ich das in die Listbox übertragen will, oder?

Listbox1.Items.Add('Typ:'FloatToStr(Typenbezeichnung));
TobiHH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

XP Pro und Vista Ultimate
Delphi 7
BeitragVerfasst: Fr 21.11.08 20:42 
Ich bin jaaaaa soooo dooooooff.

Ich hab das + vergessen :( :D

Listbox1.Items.Add('Typ:'+FloatToStr(Typenbezeichnung));

So muss es sein!
TobiHH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

XP Pro und Vista Ultimate
Delphi 7
BeitragVerfasst: Sa 22.11.08 14:49 
Sorry für den Tripple-Post

Ich habe eben noch bemerkt, das in meinem Programm ein Fehler steckt.
In der ComboBox sind reine Zahlenwerte (damit funktionierts bestens) und eine Kombination aus Zahl und Text (da kommt ein Fehler).

D.H. ich müsste die Variable anders deklarien, oder? Bloss als was und wie?

Gruß Tobi
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19336
Erhaltene Danke: 1751

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 22.11.08 15:03 
Wenn es eine Kombination ist, musst du die Auseinander nehmen. Stichworte Pos, Copy, ...
Und zum Testen ob zum Beispiel die erste Ziffer eine Zahl ist:
ausblenden Delphi-Quelltext
1:
2:
if ComboBox1.Text[1in ['0'..'9'then
  //
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Sa 22.11.08 17:11 
Und die Delphi-Tags gehen so:

[delphi]
Quellcode
[/delphi]

Das ergibt:

ausblenden Delphi-Quelltext
1:
Quellcode					


__