Delphi(Pascal) code
for I := 0 to dxDBGrid1.Count - 1do
if dxDBGrid1.Items.Selected then
begin
Field1 := dxDBGrid1.Items.Strings[0];
//第一列的值
end;
delphi的dbgrid就有这个功能
Delphi(Pascal) code
procedure TForm1.Button1Click(Sender: TObject);
var
i, j: Integer;
s: string;
begin
if DBGrid1.SelectedRows.Count>0 then
with DBGrid1.DataSource.DataSetdo
for i:=0 to DBGrid1.SelectedRows.Count-1do
begin
GotoBookmark(pointer(DBGrid1.SelectedRows.Items));
for j := 0 to FieldCount-1do
begin
if (j>0) then
s:=s+', ';
s:=s+Fields[j].AsString;
end;
Listbox1.Items.Add(s);
s:= '';
end;
end;