Dim i(1 To 50) As Integer   '--定义1到50范围的数组
Private Sub Command1_Click()
    Dim j As Integer
    j = 0
    Open App.Path & "\in13.txt" For Input As #1   '--打开程序所在目录下的in13.txt文件
    For j = 1 To 50              '--将50个数读到数组中
        Input #1, i(j)           '--从文件中读数据
    Next
    Close #1                '--关闭文件
    For j = 1 To 50
        Text1.Text = Text1.Text & i(j) & Space(5) '--将数组元素连起来,之间用5个空格分隔
    Next
End SubPrivate Sub Command2_Click()
    Dim temp As Long
    Dim j As Integer
    For j = 1 To 50              '--将数组内的200到400之间的数相加
        If i(j) >= 200 And i(j) < 400 Then
            temp = temp + i(j)
        End If
    Next
    Text1.Text = temp       '--相加结果在Text1中显示
    putdata temp           '--调用自定义过程将temp传过去
End Sub