Autor Beitrag
kuba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mo 14.08.06 15:19 
Hallo Leute,

habe ein kleines Problem. Und zwar habe ich einen String, den ich in meiner Combobox suchen und anzeigen will.


Mit diesem Befehl funktioniert es wunderbar.

ausblenden Delphi-Quelltext
1:
ComboBox.ItemIndex := ComboBox.Items.IndexOf('1     Auto');					



Aber mein Problem ist, ich habe nur den Teilstring Auto. Und dann funktioniert das ganze nicht mehr. Gibt es eine Möglichkeit nur nach einem Teilstring zu suchen?

Danke für jede Hilfe!
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 14.08.06 15:43 
In dedem du manuell den Teilstring in den einzelnen Elementen der Combobox suchst ( in einer Schleife).

_________________
Markus Kinzler.
kuba Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mo 14.08.06 16:52 
Ich habe es auch schon in einer Schleife versucht, aber da ich nicht den kompletten Inhalt der ComboBox kenne (bsp.: 1 Auto), sondern nur den Text ('Auto', oder 'Au'), findet er den Wert nicht.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 14.08.06 16:58 
ausblenden Delphi-Quelltext
1:
2:
3:
for i := 0 to ComboBox1.Items.Count - 1 do
  if pos('Auto', ComboBox1.Items[i]) >= 1 then
    showmessage('Auto gefunden bei Index ' + IntToStr(i));

_________________
We are, we were and will not be.
kuba Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Di 15.08.06 10:42 
Vielen Dank so hat es geklappt. (Warum bin ich nicht schon vorher auf pos gekommen...)

:-P