MSFlexGrid的计算
要实现下图功能,为什么计算结果从25-370开始显示啊,我想要从15-250开始显示啊.是不是循环写的有问题,肯请帮助!代码如下:
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
[[italic] 本帖最后由 lzxagy 于 2007-12-26 14:49 编辑 [/italic]]
1.jpg
(15.65 KB)