注册 登录
编程论坛 VB6论坛

大虾给指导下,为什么每次运行时文本框中只显示一个数据

liu0033546 发布于 2013-03-30 16:34, 417 次点击
Private Sub Command1_Click()
Dim a, b(1 To 18), i, j
a = Array(16, 16, 24, 40, 46, 74, 89, 94, 105, 129, 149, 147, 158, 190, 187, 177, 191, 203, 205, 218)
i = UBound(a) - 1
For j = 1 To i
 b(j) = 0.25 * a(j - 1) + 0.5 * a(j) + 0.25 * a(j + 1)
Print b(j)
Text1.Text = b(j)
 Next j

 
End Sub
2 回复
#2
seafish0112013-03-30 18:38
把Text1的MultiLine属性设为True
Private Sub Command1_Click()
    Dim a, b(1 To 18), i, j
    a = Array(16, 16, 24, 40, 46, 74, 89, 94, 105, 129, 149, 147, 158, 190, 187, 177, 191, 203, 205, 218)
    i = UBound(a) - 1
    For j = 1 To i
        b(j) = 0.25 * a(j - 1) + 0.5 * a(j) + 0.25 * a(j + 1)
        Print b(j)
        Text1.Text = Text1.Text & vbCrLf & b(j)        '修改了这里
    Next j
End Sub
#3
liu00335462013-03-30 19:26
回复 2楼 seafish011
可以了,谢谢。
1