MsflexGrid下越超界、、、、急急急
Me.MSFlexGrid1.Cols = Me.MSFlexGrid1.Cols + 1 '新加1列
Me.MSFlexGrid1.TextMatrix(0, 7) = "序号"
For i = 1 To Me.MSFlexGrid1.Rows
Me.MSFlexGrid1.TextMatrix(i, 7) = i
Next i
Me.MSFlexGrid1.ColAlignment(7) = 4 '列居中对齐
上面是本人的源码,目的是在MsflexGrid中添加一列,显示“序号”,可在第4句“Me.MSFlexGrid1.TextMatrix(i, 7) = i
”报错:实时错误381:下标越界!未找到具体的原因,麻烦各位达人给看看问题到底出现在哪?
[解决办法]
'最后一行要用.rows-1来表达For i = 1 To Me.MSFlexGrid1.Rows - 1 Me.MSFlexGrid1.TextMatrix(i, 7) = iNext i