Delphi-PRAXiS

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 String Cols auslesen (https://www.delphipraxis.net/110946-string-cols-auslesen.html)

aaron 27. Mär 2008 00:39


String Cols auslesen
 
Hallo,
wie kann ich alle Einträge der ersten Spalte (nicht Zeile) eines Stringgrids in einer Combobox anzeigen?
Gruss
Aaron

Christian Seehase 27. Mär 2008 00:44

Re: String Cols auslesen
 
Moin Aaron,

z.B. so:

Delphi-Quellcode:
ComboBox.Items.AddStrings(StringGrid.Cols[0]);

Die Muhkuh 27. Mär 2008 00:48

Re: String Cols auslesen
 
Delphi-Quellcode:
procedure StringGridColsToComboBox(StringGrid: TStringGrid; ComboBox: TComboBox; Col: Integer);
var
  I: Integer;
begin
  ComboBox.Items.BeginUpdate;
  ComboBox.Items.Clear;

  for I := StringGrid.FixedRows to StringGrid.RowCount - 1 do
    ComboBox.Items.Add(StringGrid.Cells[Col, I]);

  ComboBox.Items.EndUpdate;
end;

procedure TForm2.Button1Click(Sender: TObject);
begin
  StringGridColsToComboBox(StringGrid1, ComboBox1, 0);
end;
Ach gemein, ich geb zu, dass vom Christian ist viel schöner...

aaron 27. Mär 2008 01:44

Re: String Cols auslesen
 
Hallo,
vielen Dank.
Was hab ich alles getestet, und ich sag jetzt nicht wie lange. :-)
Aaron


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:38 Uhr.

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