ID Number: Q85436
1.00
WINDOWS
buglist1.00
Summary:
If you change the RowHeight property of a Grid control then delete a
row with the RemoveItem method, the grid adjusts the height of the rows
below the deleted row to their default size; however, it does not update
the RowHeight property for those rows. If you reset the RowHeight
property to its current value, the Grid does not re-draw the rows to
the size given by RowHeight.
To work around this problem, set RowHeight to a different value and
then change it back to the original value.
Microsoft has confirmed this to be a problem with the Grid custom
control supplied with Microsoft Professional Toolkit for Microsoft
Visual Basic programming system version 1.0 for Windows. We are
researching this problem and will post new information here as it
becomes available.
More Information:
Steps to Reproduce Problem
--------------------------
1. Run Visual Basic, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic is already running. Form1 is created by
default.
2. From the File menu, choose Add File. In the Files box, select the
GRID.VBX custom control file. The Grid tool will appear in the
toolbox.
3. Place a Grid control (Grid1) on Form1.
4. Set the Grid1 Rows and Cols properties to 5.
5. Place two command buttons (Command1 and Command2) on Form1.
6. Place the following code in the Command1 Click event:
Sub Command1_Click ()
For count% = 0 To Grid1.Rows - 1
Grid1.RowHeight(count%) = 400
Next count%
End Sub
7. Place the following code in the Command2 Click event:
Sub Command2_Click ()
Grid1.RemoveItem 1
For count% = 0 To Grid1.Rows - 1
Debug.Print Grid1.RowHeight(count%)
Next count%
End Sub
8. Press F5 to run the program. Click on the Command1 button to set
the RowHeight properties to 400. Click Command2 to remove a row.
Notice that the grid rows are re-sized. Note that the output in the
Immediate window shows that the RowHeight property has not changed,
although visually it has.
9. Click on Command1. Note that the rows do not re-size.
Workaround
----------
You can work around this problem by replacing the code in the Command1
button Click event with the following:
Sub Command1_Click ()
For count% = 0 To Grid1.Rows - 1
Grid1.RowHeight(count%) = 399
Next count%
For count% = 0 To Grid1.Rows - 1
Grid1.RowHeight(count%) = 400
Next count%
End Sub
Additional reference words: 1.00