当前位置:Gxlcms > 数据库问题 > 在dbgrideh中允许选择多行,如何知道哪些行被选中

在dbgrideh中允许选择多行,如何知道哪些行被选中

时间:2021-07-01 10:21:17 帮助过:18人阅读

是个BOOKMARK类型的属性。

SelectedRows: TBookmarkList
procedure TForm1.Button1Click(Sender: TObject);
var
i, j: Integer;
s: string;
begin
if DBGrid1.SelectedRows.Count>0 then
  with DBGrid1.DataSource.DataSet do
   for i:=0 to DBGrid1.SelectedRows.Count-1 do
   begin
    GotoBookmark(pointer(DBGrid1.SelectedRows.Items[i]));
    for j := 0 to FieldCount-1 do
    begin
     if (j>0) then s:=s+‘, ‘;
     s:=s+Fields[j].AsString;
    end;
    Listbox1.Items.Add(s);
    s:= ‘‘;
   end;
end;  

在dbgrideh中允许选择多行,如何知道哪些行被选中

标签:items   book   cli   str   poi   ems   类型   source   选择   

人气教程排行