Autor Beitrag
daniel.diener
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Sa 05.05.07 19:13 
Hallo Leute,


ich moechte gerne folgendes realisieren:

Wenn in meiner ComboBox xxx ausgeweahlt ist, soll yyy ausgefuehrt werden.
Klingt ganz einfach. Habe es so versucht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if ComboBox.Itemindex = 'xxx'
  then begin
    yyy
  end;


Bin mir erstens nicht sicher, ob Itemindex ueberhaupt das richtige dafuer ist und zweitens sagt Delphi dann: Inkompatible Typen: 'string' und 'Integer'

Klingt alles voll einfach, aber ich bekomme es einfach nicht hin :( Bin halt ncoh ein noob. :oops:

Bin Dankbar fuer jede Antwort!

Gruss
Daniel


PS: Wie bekomme ich es hin, dass mein Code hier im Forum aussieht wie echter Code von Delphi?


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 05.05.2007 um 20:22
Silas
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 478

Windows XP Home
Delphi 2005, RAD Studio 2007, MASM32, FASM, SharpDevelop 3.0
BeitragVerfasst: Sa 05.05.07 19:20 
Bei der ComboBox musst du die Items über ihre Nummer abfragen, nicht über ihren Inhalt: Wenn die Box 'Hallo1', 'Hallo2' und 'Hallo3' enthält ist, wenn 'Hallo1' ausgewählt ist, der ItemIndex 0, bei 'Hallo2' ist er 1 und bei 'Hallo3' 2 usw.

_________________
Religionskriege sind nur Streitigkeiten darüber, wer den cooleren imaginären Freund hat ;-)
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 05.05.07 19:30 
Item - index
Überlege dir doch einmal, was es heißt!! Ist doch klar, dass bei einem Index keine Zeichenkette erwartet wird. :roll:
Oder: Itemindex markieren und F1 drücken.

Delphi Tags kannst du so machen: [delphi] code [/delphi] ;)

grüße marc
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Sa 05.05.07 19:33 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if combobox1.Text = 'xxx' then
begin
yyy;
end;
daniel.diener Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Sa 05.05.07 21:08 
Danke, hat wunderbar funktioniert!