vb6 - 如何解决VB6中的MSFlexGrid错误30006

标签 vb6 error-handling msflexgrid

MSFlexGrid每次达到〜350,000个单元时都会给出此30006错误。
错误定义:

Run-time error '30006':

Unable to Allocate Memory For 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个单元格,那么我该如何解决呢?

最佳答案

'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

关于vb6 - 如何解决VB6中的MSFlexGrid错误30006,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12583361/

相关文章:

python - 如何访问包装在sqlalchemy错误中的psycopg2错误

python - 如何解决TypeError : unsupported operand type(s) for +: 'float' and 'tuple'

variables - VB6:禁用变体

mysql - 使用vb6从wampserver导出mysql数据库

mysql - VB6 在模块中声明网页浏览器

c - 我试图打开一个 .csv 文件并在 C 编程中将其作为数组中的字符串读取

logging - VB6-如何在启动应用程序时在VB6中创建日志文件

sql - 运行时错误 '3704' 在 VB6 中使用临时表使用 SP 时关闭对象时不允许操作

css - Primeflex Flexgrid 是否支持 IE11?让 flexgrid 在 IE 上工作的任何解决方法?

vb6 - MSFlexGrid 编辑 VB6