Autor Beitrag
[vsc]PrimeTime
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

XP SP0
Delphi 6 Pers. (eng), Delphi 2005
BeitragVerfasst: Di 02.03.04 10:46 
Wie kann ich in einer ListBox nach einen (Teil-)String suchen? :?:

_________________
-=the things you own, own you=-
JESUS SAVES, the rest of you takes full damage!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 02.03.04 10:55 
Hallo!

Bitte die Suchfunktion benutzen.

Dieser Beitrag ist noch nicht sehr alt.

MfG
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: Di 02.03.04 10:56 
In dem Du die Listbox.Items manuell überprüfst, also in der Art:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure Search(Items: TStrings; const SubStr : String);
var
  iLoop : Integer;
begin
  for iLoop := 0 to (Items.Count - 1) do begin
    if (Pos(UpperCase(SubStr), UpperCase(Items[iLoop]) > 0) then begin
       // Gefunden, mach was damit
    end;
  end;
end;

// Aufruf mit:
  Search('Hallo', Listbox.Items);


Gruß
KidPaddle
[vsc]PrimeTime Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

XP SP0
Delphi 6 Pers. (eng), Delphi 2005
BeitragVerfasst: Do 04.03.04 15:17 
Titel: Auch TeilStrings?
Die Idee is super, Danke!

Geht das auch wenn ich nur Teile eines Strings in der Stringlist suchen will?

Das Ganze kommt daher, dass ich ein Proggy schreiben will in dem man in eine ListBox 'Titel, Künstler, Album' hinzufügt (geht schon), aber ich will jetzt eine Suchfunktion einbauen, mit der ich z.B. nur ein Teil des Titels, des Albums, ... angebe und das mir dann die Suchergebnisse angezeigt werden, die diesen String als Teil in ihren Angaben besitzen. Fürs erste reichts, wenn man nur nach einem Wort suchen kann.

Thxx

PrimeTime

_________________
-=the things you own, own you=-
JESUS SAVES, the rest of you takes full damage!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 04.03.04 16:32 
Hallo!

Sowohl die Funktion, die Du findest, wenn Du dem Link folgst als auch die hier gepostete Funktion leisten dies.

MfG
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".