Results 1 to 3 of 3

Thread: RemoveItems from MSHFlexGrid

  1. #1
    navic99
    Guest

    RemoveItems from MSHFlexGrid

    I have 2 command buttons, "Remove" and "Add" in reference to adding and removing rows on an MSHFlexGrid.

    For the "Remove" code, I use:

    FlxGrid.RemoveItem (FlxGridRow)

    to remove whatever row is selected. This works fine but it seems to create a hidden row.

    To add a new row, I now have press the "Add" command button twice to get the new row to show. I follow through the code, and it is firing and I even see a little "flicker" on the grid like a new row appearing and than dissapearing. When I hit my "Add" button again, then the new row appears with the appropriate data.

    Let's say I "Remove" 3 rows, then I have to press my "Add" button 4 times to get the new row to appear.

    My "Add" code works fine if I just add new rows without removing any first.

    I follow the code and count the rows created and removed and it all appears to be as it should...like if I start with 5 rows, remove 3 and add 4, then the new total is 6 although I can only see 3 of them. I can see the last one added, but not the first 3.

    Help! Thanks.

  2. #2
    Fanatic Member
    Join Date
    Jun 2001
    Posts
    521
    Use this instead, with command buttoms cmdFlexAdd and cmdFlexRemove, and flex being the MSFlexGrid:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub cmdFlexAdd_Click()
    4.     With flex
    5.         .Rows = .Rows + 1
    6.     End With
    7. End Sub
    8.  
    9. Private Sub cmdFlexRemove_Click()
    10.     With flex
    11.         If .Rows > 2 Then .Rows = .Rows - 1
    12.     End With
    13. End Sub

  3. #3
    navic99
    Guest
    Thanks...

    I found the problem with my code. There's a bug with the REMOVEITEM mehod. It resizes the row height to 0, so you have to reset the rowheight to whatever it was before removing any rows. So, the row was there, but the height was 0.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width