Ich habe ein Listview, jedes Item hat 1 SubItem. Außerdem habe ich ein Editfeld.
Ich möchte nun, das bei einer Eingabe im Editfeld das komplette ListView durchsucht wird und Dabei das Item bei dem jedes Wort aus dem Editfeld im SubItem vorkommt in einer Variable hinterlegt wird ...
Beispiel: ListView
Code: Alles auswählen
44687651 11380 XL apple green
12389712 502EG - forrest green
93847573 11380 L deep black
Code: Alles auswählen
var Bestand: Double;
Ts : TStrings;
S,S2 : String;
I,I2 : LongInt;
Fnd : Integer;
begin
If Pos(' ',Form1.Barcode.Text) = 0 then DbItem := Form1.BarCode.Text
else
Begin
TS := TStringlist.Create;
S := Form1.BarCode.Text;
While Pos(' ',S) > 0 do
Begin
S2 := Copy(S,1,Pos(' ',S)-1);
Delete(S,1,Pos(' ',S));
TS.Add(UpperCase(S2));
end;
If length(S) > 0 then TS.Add(S);
For I := 0 to Form1.ArtikelView.Items.Count-1 do
Begin
Fnd := 0;
For I2 := 0 to TS.Count-1 do
Begin
If (I2 = 0) or (I2 = TS.Count) then
Begin
If Pos(Ts[I2],UpperCase(Form1.ArtikelView.Items[I].SubItems[0])) > 0 then Fnd := Fnd + 1;
end;
If (I2 > 0) and (I2 < TS.Count) then
Begin
If Pos(Ts[I2]+' ',UpperCase(Form1.ArtikelView.Items[I].SubItems[0])) > 0 then Fnd := Fnd + 1;
end;
end;
If Fnd = Ts.Count then
Begin
DbItem := Form1.ArtikelView.Items[i].Caption;
Break;
end;
end;
TS.Free;
end;
Vorab danke für eure Hilfe
