Advertisement
jpfassis

Filter - Stringrid - Delphi

Apr 22nd, 2020
1,474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.68 KB | None | 0 0
  1. procedure Filter(ACol: Integer; Exp: String);
  2. var
  3.   I,Counter:Integer;
  4. begin
  5. FilterList:=TStringList.Create;
  6.   With StringGrid1 do
  7.   begin
  8.     //Filterliste mit Gridinhalt füllen
  9.     For I := FixedRows To RowCount - 1 Do
  10.       FilterList.Add(Rows[I].Text);
  11.  
  12.     //Grid filtern
  13.     Counter:=FixedRows;
  14.     For I := FixedRows To RowCount - 1 Do
  15.     Begin
  16.       If Cells[ACol,I] <> Exp Then
  17.       Begin
  18.          Rows[I].Clear;
  19.       end
  20.       Else
  21.       begin
  22.          If Counter <> I Then
  23.          Begin
  24.            Rows[Counter].Assign(Rows[I]);
  25.            Rows[I].Clear;
  26.          End;
  27.          Inc(Counter);
  28.       End;
  29.     End;
  30.     RowCount:=Counter;
  31.   End;
  32. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement