Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Ausgewählte Zeilen e. Stringgrid's i.e. anderes Stringgrid (https://www.delphipraxis.net/110757-ausgewaehlte-zeilen-e-stringgrids-i-e-anderes-stringgrid.html)

aaron 24. Mär 2008 14:13

Re: Ausgewählte Zeilen e. Stringgrid's i.e. anderes Stringg
 
Liste der Anhänge anzeigen (Anzahl: 1)
Klar. :)

mkinzler 24. Mär 2008 14:38

Re: Ausgewählte Zeilen e. Stringgrid's i.e. anderes Stringg
 
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i, x2, j: integer;
begin
  j := 0;
  for i := 1 to StringGrid1.RowCount - 1 do
  begin
     if stringgrid1.GetCheckBoxState(0, i, state) then
     begin
       if state = true then
       begin
          Inc(j);
          for x2 := 1 to StringGrid1.ColCount - 1 do
          begin
            StringGrid2.Cells[x2, j] := StringGrid1.Cells[x2, i];
          end;
       end;
     end;
  end;
end;

aaron 24. Mär 2008 14:57

Re: Ausgewählte Zeilen e. Stringgrid's i.e. anderes Stringg
 
Jepp, das funktioniert.
Ich hatte zwar auch in der Richtung probiert aber letztenendes das Inc(j); und
StringGrid2.Cells[x2-1, j-1] nicht gewußt.
:-)
Danke
Aaron

mkinzler 24. Mär 2008 15:01

Re: Ausgewählte Zeilen e. Stringgrid's i.e. anderes Stringg
 
Die weitere Variable j hab ich eingeführt, um keine Leerzeilen im Grid zu erhalten.
Bei .Cells hast du einfach übersehen, dass hier Zeilen und Spalten vertauscht ist.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:51 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz