FIX: MSHFLexGrid Does Not Display More Than 2048 Rows (194653)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q194653 SYMPTOMS
The Hierarchical FlexGrid control always displays a maximum of 2048 rows
regardless of the number of records in the data source.
RESOLUTION
Although the record-count of the mshflexgrid is correct, only the first
2048 records are displayed. If you need to display more than 2048, you
need to open the recordset and populate the grid using the GetString
method of ADO and the Clip property of the MSHFlexGrid.
The code below can be used in place of the code in the Command1_Click event
in the MORE INFORMATION section to work around this behavior:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rsVar As Variant
Dim i As Integer
cn.Open "Testing" '<-- Your DSN
rs.Open "select * from Cies", cn, adOpenStatic, adLockOptimistic
rs.MoveLast
rs.MoveFirst
' Assuming that rs is your ADO recordset
MSHFlexGrid1.Rows = rs.RecordCount + 1
rsVar = rs.GetString(adClipString, rs.RecordCount)
MSHFlexGrid1.Cols = rs.Fields.Count
' Set column names in the grid
For i = 0 To rs.Fields.Count - 1
MSHFlexGrid1.TextMatrix(0, i) = rs.Fields(i).Name
Next
MSHFlexGrid1.Row = 1
MSHFlexGrid1.Col = 0
' Set range of cells in the grid
MSHFlexGrid1.RowSel = MSHFlexGrid1.Rows - 1
MSHFlexGrid1.ColSel = MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Clip = rsVar
' Reset the grid's selected range of cells
MSHFlexGrid1.RowSel = MSHFlexGrid1.Row
MSHFlexGrid1.ColSel = MSHFlexGrid1.Col
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbBug kbVS600sp3fix KB194653 |
---|
|