Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Dec 19, 2000

Determining an Absolute Row Index


Often properties and methods associated with grid controls don't provide an absolute row index of current or selected rows (relative to the actual first row and not the first displayed row). The 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.
Nazmul Siddiqui
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date