循环的显示
要实现下图功能,为什么计算结果从25-370开始显示啊,我想要从15-250开始显示啊,然后一直显示下去,直到最后结束.知道是For row = 1 To MSFlexGrid2.Rows - 1中的row出错了,但我不知道怎么改,肯请帮助!代码如下:
Private Sub Command2_Click()
With MSFlexGrid2
Dim a, b, c, d, e, n, x, row, col As Integer
x = MSFlexGrid1.Rows
For n = 1 To x - 2
a = Val(MSFlexGrid1.TextMatrix(n, 0))
b = Val(MSFlexGrid1.TextMatrix(n, 1))
c = Val(MSFlexGrid1.TextMatrix(n + 1, 0))
d = Val(MSFlexGrid1.TextMatrix(n + 1, 1))
MSFlexGrid2.Rows = c - a + 2
MSFlexGrid2.Cols = 2
e = Int((d - b) / (c - a))
MSFlexGrid2.TextMatrix(0, 0) = "高度"
MSFlexGrid2.TextMatrix(0, 1) = "容积"
MSFlexGrid2.TextMatrix(1, 0) = e
For row = 1 To MSFlexGrid2.Rows - 1
MSFlexGrid2.TextMatrix(row, 0) = a
MSFlexGrid2.TextMatrix(row, 1) = b
a = a + 1
b = b + e
Next row
Next n
End With
End Sub --------------------编程问答-------------------- "For n = 1 To x - 2"
当n=2时,出错: "For row = 1 To MSFlexGrid2.Rows - 1"
现在表格的值(也就是25,370)覆盖了原来表格的置(也就是15,250)
x=?
补充:VB , 基础类