# 参考看看

Posted by 纪文和 on October 04, 1999 at 13:22:12:

In Reply to: 值不对喔 posted by 数学白痴 on October 04, 1999 at 11:28:08:

: : : X1=10 ---> Y1=100
: : : X2=20 ---> Y2=300
: : : X3=30 ---> Y3=600
: : : X4=40 ---> Y4=1000
: : : X5=50 ---> Y5=1500

我用了一个 textbox 来输入一个值, 二个 listbox 来 show x(i) 及 y(i) 的值

Private Sub Command1_Click()
Dim n
n = Val(Text1)
ReDim x(n)
ReDim y(n)
List1.Clear
List2.Clear
For i = 1 To n
x(i) = i * 10
y(i) = ((i * (i + 1)) / 2) * 100
List1.AddItem x(i)
List2.AddItem y(i)
Next
End Sub

VB入门网

Follow Ups: