devxlogo

Determine Absolute Row Index

Determine Absolute Row Index

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.

See also  Essential Measures for Safeguarding Your Digital Data
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist