0

MSFlexGrid は、約 350,000 セルに達するたびに、この 30006 エラーを返します。

エラー定義:

実行時エラー '30006':

FlexGrid にメモリを割り当てられません

私のコードサンプル:

Do While Not rs.EOF
    With MSFlexGrid1
        .Rows = .Rows + 1
        .TextMatrix(i, 1) = rs.Fields("1")    's1
        .TextMatrix(i, 2) = rs.Fields("2")    's2
        .TextMatrix(i, 3) = rs.Fields("3")    'f1
        .TextMatrix(i, 4) = rs.Fields("4")    'gr1
        .TextMatrix(i, 5) = rs.Fields("5")    'gr2
        .TextMatrix(i, 6) = rs.Fields("6")    'gr3
        .TextMatrix(i, 7) = rs.Fields("7")    'gr4
        .TextMatrix(i, 8) = rs.Fields("8")    'gr5
        .TextMatrix(i, 9) = rs.Fields("9")    'gr6
        .TextMatrix(i, 10) = rs.Fields("10")  'gr7
        .TextMatrix(i, 11) = rs.Fields("11")  'gr8
        .TextMatrix(i, 12) = rs.Fields("12")  'c1
        .TextMatrix(i, 13) = rs.Fields("13")  'g1
        .TextMatrix(i, 14) = rs.Fields("14")  's3
        .TextMatrix(i, 15) = rs.Fields("15")  'f2
        .CellAlignment = 4
        .TopRow = .Rows - 1
        .Refresh
    End With
    i = i + 1
    rs.MoveNext
Loop

MSFlexGrid で少なくとも 600,000 個のセルを使用する必要があるため、これを解決するにはどうすればよいですか?

4

1 に答える 1

0
'I got 15 columns so this makes 21874row * 15column = 328110 cells
'it blows at 21875th row so 328125th cell is not reachable
'for that reason i reset the grid so it keeps 
Do While Not rs.EOF
    With MSFlexGrid1
        If .Rows >= 21874 Then
            .Rows = 2
            .Clear
            i = 1
        End If
        .Rows = .Rows + 1
        .TextMatrix(i, 1) = rs.Fields("1")    's1
        .TextMatrix(i, 2) = rs.Fields("2")    's2
        .TextMatrix(i, 3) = rs.Fields("3")    'f1
        .TextMatrix(i, 4) = rs.Fields("4")    'gr1
        .TextMatrix(i, 5) = rs.Fields("5")    'gr2
        .TextMatrix(i, 6) = rs.Fields("6")    'gr3
        .TextMatrix(i, 7) = rs.Fields("7")    'gr4
        .TextMatrix(i, 8) = rs.Fields("8")    'gr5
        .TextMatrix(i, 9) = rs.Fields("9")    'gr6
        .TextMatrix(i, 10) = rs.Fields("10")  'gr7
        .TextMatrix(i, 11) = rs.Fields("11")  'gr8
        .TextMatrix(i, 12) = rs.Fields("12")  'c1
        .TextMatrix(i, 13) = rs.Fields("13")  'g1
        .TextMatrix(i, 14) = rs.Fields("14")  's3
        .TextMatrix(i, 15) = rs.Fields("15")  'f2
        .CellAlignment = 4
        .TopRow = .Rows - 1
        .Refresh
    End With
    i = i + 1
    rs.MoveNext
Loop
于 2012-09-26T13:45:18.470 に答える