1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to automatic highlight all the rows using TDBGrid?

Discussion in 'Visual Basic ( VB )' started by davidgwillis, Oct 7, 2010.

  1. davidgwillis

    davidgwillis New Member

    Joined:
    Oct 7, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VB Software Developer
    Location:
    Hong Kong
    Hi,

    I had been trying to figure out for more than 2 weeks for the answer in
    this website or others, but just couldn't find any sulution to solve my problem.

    I had around over 1000 records which mean 1000 rows displayed in the TDBGrid. I had a button for Select All and when the user click on it, it will
    automatic highligth all the records for me. I did manage to highlight some
    reocords but it stop at invalid row number 19. I believe reason why it stop
    or fail on row number 19 is because that were the visiable row?

    Visual Baisc Code

    For i = 0 To 1000
    TDBGrid1.SelBookmarks.Add TDBGrid1.RowBookmark(i)
    Next i

    or

    TDBGrid1.MoveFirst
    For i = 0 to MaxRows
    TDBGrid1.SelBookmarks.Add TDBGrid1.RowBookmark(i)
    TDBGrid1.MoveNext
    Next i

    Does anyone can help me with this?

    Thanks

    David :thinking:
     
  2. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    send your project and what is necessary to compile and run
    in a zip file
     
  3. davidgwillis

    davidgwillis New Member

    Joined:
    Oct 7, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VB Software Developer
    Location:
    Hong Kong
    Thank virxen.... I just fix the problem. Instead of using the RowBookmark since is only useful for the visible row, I use GetBookMark and it work.
     

Share This Page