Current row in grid

105 views
Skip to first unread message

Andre Renaud

unread,
Mar 10, 2016, 6:12:39 PM3/10/16
to Rosi Delphi Components
How can I get the current row of a dbgrid

Tomas Rosinsky

unread,
Mar 11, 2016, 1:54:58 AM3/11/16
to Rosi Delphi Components
DBGrid does not public Row property but you can read it by following hack:

type
  THackDBGrid = class(TDBGrid);

function ReadRowIndex: integer;
begin
  Result := THackDBGrid(DBGrid1).Row;
end;

Be carefull to use Row property in DBGrid. You can read it (even I do not know why) but never set Row directly. To select any row you have to move dataset to needed record.

I hope it helps.
Tomas
Reply all
Reply to author
Forward
0 new messages