Option Base 1
Dim Arr(100) As Integer
Dim num As Integer
Sub ReadData()
Open App.Path & "\" & "datain6.txt" For Input As #1
For i = 1 To 100
Input #1, Arr(i)
Next i
Close #1
End Sub
Sub WriteData(Filename As String, num as integer)
Open App.Path & "\" & Filename For Output As #1
Print #1, num
Close #1
End Sub
Private Sub calc_Click()
Dim num
num = 0
Text1.Text = ""
For i = 1 To 100
If Arr(i) > 50 Then
Text1.Text = Text1.Text & " " & Arr(i)
num = num + Arr(i)
End If
Next i
Print num
End Sub
Private Sub read_Click()
Call ReadData
End Sub
Private Sub save_Click()
Call WriteData("datat.txt", num)
End Sub
运行程序之后打开datat.txt,里面的内容显示是0,为什么呢?
代码有什么地方出了错,希望各位高手帮帮忙,本人初学VB,还是个菜鸟