Often, properties and methods associated with grid controls don’t provide an absolute (relative to the actual first row and not the first displayed row) row index of current or selected rows. Sample code below provides the index of the current row, assuming the absolute first row has an index of 0:
'Get the absolute row index of the current row Dim iCounter as Integer iCounter = 0 While Not IsNull(grd.GetBookmark(iCounter - 1)) 'grd is a name for the Grid iCounter = iCounter - 1 Wend iCounter = Abs(iCounter)
Note: iCounter is the current absolute row index. GetBookmark is a public method provided by the grid. Null is returned when the offset reaches BOF.