StringGrid
Estou carregando um stringgrid,
Descricao
teste1
teste2
teste3
teste4
teste5
A procedure ira excluir os tres primeiro registros
vconta1:=1;
vconta2:=3;
vvalortotal:=Grid.RowCount;
for j := 1 to Grid.RowCount do
begin
for h := vconta1 to vconta2 do
begin
Grid.Cells[1,h]:='';
vconta1:=vconta1+1;
end;
end;
O resultado disso esta assim: Com os espaço de 3 linha
Linha Descricao
teste4
teste5
Gostaria que ficar assim:
Descricao
teste4
teste5
Evandro Abreu
Curtidas 0
Respostas
Marco Salles
09/08/2010
Estou carregando um stringgrid, Descricao teste1 teste2 teste3 teste4 teste5 A procedure ira excluir os tres primeiro registros vconta1:=1; vconta2:=3; vvalortotal:=Grid.RowCount; for j := 1 to Grid.RowCount do begin for h := vconta1 to vconta2 do begin Grid.Cells[1,h]:=''; vconta1:=vconta1+1; end; end; O resultado disso esta assim: Com os espaço de 3 linha Linha Descricao teste4 teste5 Gostaria que ficar assim: Descricao teste4 teste5
..
poderia dar mais detalhes
ficou meio confuso , pelo menos para mim
GOSTEI 0
Eriley Barbosa
09/08/2010
Após a procedure excluir o conteúdo das linhas não é só copiar as linhas que sobraram com conteúdo para cima:
for i:= StringGrid.Row to StringGrid.RowCount - 1 do
StringGridCells[0, i] := StringGrid.Cells[0, i + 1]; Ou você vê se a célula ta vazia e apaga ela: for i:= StringGrid.Row to StringGrid.RowCount - 1 do begin
if StringGridCells[0, i] = '' then RowCount := RowCount -1; {retira uma linha} end; Atenciosamente Eriley
StringGridCells[0, i] := StringGrid.Cells[0, i + 1]; Ou você vê se a célula ta vazia e apaga ela: for i:= StringGrid.Row to StringGrid.RowCount - 1 do begin
if StringGridCells[0, i] = '' then RowCount := RowCount -1; {retira uma linha} end; Atenciosamente Eriley
GOSTEI 0
Eriley Barbosa
09/08/2010
Opa faltou os pontos:
Após a procedure excluir o conteúdo das linhas não é só copiar as linhas que sobraram com conteúdo para cima:
for i:= StringGrid.Row to StringGrid.RowCount - 1 do
StringGrid.Cells[0, i] := StringGrid.Cells[0, i + 1]; Ou você vê se a célula ta vazia e apaga ela: for i:= StringGrid.Row to StringGrid.RowCount - 1 do begin
if StringGrid.Cells[0, i] = '' then StringGrid.RowCount := StringGrid.RowCount -1; {retira uma linha} end; Atenciosamente Eriley
StringGrid.Cells[0, i] := StringGrid.Cells[0, i + 1]; Ou você vê se a célula ta vazia e apaga ela: for i:= StringGrid.Row to StringGrid.RowCount - 1 do begin
if StringGrid.Cells[0, i] = '' then StringGrid.RowCount := StringGrid.RowCount -1; {retira uma linha} end; Atenciosamente Eriley
GOSTEI 0