|
-
Jul 6th, 2001, 10:11 AM
#1
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.
-
Jul 6th, 2001, 01:15 PM
#2
Fanatic Member
Use this instead, with command buttoms cmdFlexAdd and cmdFlexRemove, and flex being the MSFlexGrid:
VB Code:
Option Explicit
Private Sub cmdFlexAdd_Click()
With flex
.Rows = .Rows + 1
End With
End Sub
Private Sub cmdFlexRemove_Click()
With flex
If .Rows > 2 Then .Rows = .Rows - 1
End With
End Sub
-
Jul 7th, 2001, 12:55 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|