Scalabium Software

SMExport advertising
Knowledge for your independence'.
Home Delphi and C++Builder tips


#43: How can I iterate the selected rows in DBGrid?

If your users can select a rows in the DBGrid, then you must navigate and process them. The TDBGrid component have a SelectedRows property, in which stores a list with bookmarks on each selected record.

var i: Integer;
begin
  for i := 0 to yourMDBGrid.SelectedRows.Count-1 do
  begin
    yourMDBGrid.DataSource.DataSet.Bookmark := yourMDBGrid.SelectedRows[i];

    {here you can process a selected record.
     For example, to sum the Amount field values}
    Inc(intSumAmount, yourMDBGrid.DataSource.DataSet.FieldByName('Amount').AsFloat);
  end;
end;


Published: November 19, 1999

See also
 
DBLoad
ABA Spreadsheet Convert
Viewer for TNEF-files (winmail.dat)
Paradox to Text converter
DBISAM Viewer
Fast Document Viewer
MAPIMail
Clarion Viewer
SMReport
Paradox to MS Access converter
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2023, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport/SMImport suites