Autor Beitrag
nas4killer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: So 09.03.03 22:48 
hi

folgendes habe ich vor

Edit1 ( Multiplikator )
ComboBox1 aus wahl aus paar Namen und jeder namen soll eine bestimmte zahl sein Edit2 soll das ergebnis von Edit1 mal den Wert von ComboBox1 sein.

z.B.
ausblenden Quelltext
1:
2:
Edit1.Text := 5
ComboBox1.Text := Cool

Cool hat z.B. den wert 3.
ausblenden Quelltext
1:
Edit2.Text := IntToStr( StrToInt ( Edit1.Text ) * StrToInt ( ComboBox1.Text ));					

Als ergebnis kommt 15.

Danke.

Wenn ihr es nicht versteht kann ich das kleine Prog auch schicken und versuchen besser zu erklären.

Moderiert von user profile iconTino: Code-Tags hinzugefügt.
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 09.03.03 23:01 
weiß nichtb ob ich es richtig verstanden habe...
aber wenn du jedem Namen aus der Combobox eine Zahl zuordnen willst, dann kannste ja ne Integer Variable nehmen und die dann mit der Nummer von dem Namen belegen, die du wie folgt rauskriegst:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
IntVar:=-1;
if combobox1.text='Cool' then IntVar:=3;
if combobox1.text='Auch Cool' then IntVar:=2;
if combobox1.text='Schon wieder Cool' then IntVar:=1;
...
if IntVar=-1 then showmessage('Es war ein falscher Name in der Combobox');
nas4killer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: So 09.03.03 23:50 
Du hast mich schon richtig verstanden leider mekert aber Delphi das er IntVar=-1 nicht kennt. Muss ich irgenwelche uses einbringen ? Danke
Jack Falworth
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 222

Win XP Pro, Slackware 10.0
D5 Enterprise, C++, ABAP
BeitragVerfasst: Mo 10.03.03 00:12 
Mit IntVar meint Fiji-Fighter wohl eine Integer Variable mit dem Namen "IntVar", die du selbst anlegen musst.

MfG

Jack Falworth

_________________
Andere zu kritisieren ist mitunter eine Möglichkeit, sich selbst ins bessere Licht zu setzen.
nas4killer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mo 10.03.03 20:58 
Und wie kann ich dies machen ?
GruppeCN
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 322



BeitragVerfasst: Mo 10.03.03 21:09 
Etwas weiter oben gibt es einen Teil(in der Code ansicht), wo steht:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
var
  Form1: TForm1;

implementation

{$R *.dfm}

Das muss hinterher da stehen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  Form1: TForm1;
  IntVar:Integer;

implementation

{$R *.dfm}


Ich will nur mal so anmerken, aber wie man eine Variable deklariert, müsste man eigentlich wissen, wenn man mit ComboBoxen arbeiten will...

Ach ja, dein Code von oben ist auch fehlerhaft. Du schriebst:
ausblenden Quelltext
1:
2:
Edit1.Text := 5;
ComboBox1.Text := Cool;

Richtig ist:
ausblenden Quelltext
1:
2:
Edit1.Text := InttoStr5);
ComboBox1.Text := 'Cool';

_________________
Warum sind die Sachen, die du suchst, immer da, wo du zuletzt nachsiehst?
Weil du aufhörst zu suchen, wenn du sie gefunden hast.
GruppeCN
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 322



BeitragVerfasst: Mo 10.03.03 21:16 
Was auch noch eine, etwas einfachere Möglichkeit wäre:

ausblenden Quelltext
1:
Edit1.Text := InttoStr(ComboBox1.ItemIndex+1;)					

_________________
Warum sind die Sachen, die du suchst, immer da, wo du zuletzt nachsiehst?
Weil du aufhörst zu suchen, wenn du sie gefunden hast.
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 10.03.03 22:50 
er hat aber geschrieben, das er die Zahl anhand des Namens herauskriegen will und nicht anhand der Stelle in der Combobox :(
GruppeCN
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 322



BeitragVerfasst: Di 11.03.03 17:15 
Dann halt das obere! War ja nur eine Idee, falls er die Nummern nach der Stellung bekommen wollte. :evil:

_________________
Warum sind die Sachen, die du suchst, immer da, wo du zuletzt nachsiehst?
Weil du aufhörst zu suchen, wenn du sie gefunden hast.