grideh SelectedRows Bookmark

时间:2022-08-15 08:09:20

VCL

grideh 选中多行 TBookmark、Bookmark、GotoBookmark

if(DBGridEh1->SelectedRows->Count == 0 )
   DBGridEh1->SelectedRows->CurrentRowSelected = true;

 TBookmark bm=  DataSet->GetBookmark();
DataSet->Filtered = false;
DataSet->Filter="";
DataSet->GotoBookmark(bm);

TDataSet *ds =  DBGridEh1->DataSource->DataSet;

ds->GotoBookmark((TBookmark)DBGridEh1->SelectedRows->Items[i]);
        for (int i = ; i < DBGridEh1->SelectedRows->Count; i++)
{
DBGridEh1->DataSource->DataSet->GotoBookmark((TBookmark)DBGridEh1->SelectedRows->Items[i]);
{
        ds->FieldByName("gg")->AsString.Trim()
}
}
    for (int i = ; i < curGrid->SelectedRows->Count; i++)
{
curds->GotoBookmark((TBookmark)curGrid->SelectedRows->Items[i]);
{ }
}

TBookmark bm=  DataSource1->DataSet->GetBookmark();
 DataSource1->DataSet->Filtered = false;
 DataSource1->DataSet->Filter="";
   DataSource1->DataSet->GotoBookmark(bm);

FireMonkey

StringGrid
 Self.StringGrid1.Cells[, Self.StringGrid1.Selected]

 FireMonkey  Grid

Columns

ColumnIndex

Grid1.Columns[Grid1.ColumnIndex]

self.Grid1.Columns[self.Grid1.ColumnIndex].Data

直接用dataset取就可以了。

Column.Header 列标题

dataset.GetRow

oRow: TFDDatSRow;

oRow.RowID

TField

AFld.OldValue

AFld.CurValue

AFld.NewValue

删除选中行

DBGridEh1->SelectedRows->Delete();