Ver Mensaje Individual
  #7  
Antiguo 25-06-2012
JoseSagas JoseSagas is offline
Miembro
NULL
 
Registrado: jun 2012
Posts: 33
Reputación: 0
JoseSagas Va por buen camino
Código Delphi [-]
var //global
 fil2: integer;
 ori: array[1..1000] of string;

//fil2 = stringgrid2.rowcount

procedure TForm4.LabeledEdit64Change(Sender: TObject);
var
 nom: string;
 i,j,tam,cont,fil,cont2: integer;
 enc: array[1..1000] of string;
begin
 nom:= labelededit64.Text;
 tam:= length(nom);
 cont:= 0;
 cont2:= 1;
if nom='' then
  begin
   stringgrid2.RowCount:= fil2;
    for i := 1 to fil2 do
      begin
        stringgrid2.Cells[0,i]:= ori[i];
      end;
  end else
  begin
   i:=1;
     while i<>fil2 do
       begin
         if pos(uppercase(nom),uppercase(ori[i]))<>0 then
          begin
            enc[cont2]:= ori[i];
            cont2:= cont2+1;
            inc(i);
          end else
           inc(i);
       end;
     for I := 1 to fil2 do
      begin
        stringgrid2.Cells[0,i]:= '';
      end;
     stringgrid2.RowCount:= cont2;
     for I := 1 to cont2 do
       begin
        stringgrid2.Cells[0,i]:= enc[i];
       end;
   end;
end;

esta es la soli¿ucion que le di... utilize POS para ver si el string que esta buscando esta dentro de alguno de los strings que tiene el stringgrid2 en cada una de las celdas del mismo, luego cuando encuentro que SI esta entonces los guardo en la variable ENC que es un vector y siempre lo va buscando en el venctor ORI que es el origininal osea lo que tenia el stringgrid2 antes de comenzar la busqueda... de esta forma nunca faltara ningun dato, espero que les funcione si lo llegan a probar suerte
Responder Con Cita