新建一个工程,添加一个CommandButton控件,将窗体的AutoRedraw属性改为True,双击CommandButton控件,将下面代码复制过去即可。
Dim i As Long, x As Long, s As Long
Open "c:\abc.txt" For Binary As #1
For i = 1 To 10
x = Rnd() * 100
x = x * 2
Put #1, , x
Next i
Close #1
Open "c:\abc.txt" For Binary As #1
s = 0
For i = 1 To 10
Get #1, , x
s = s + x
Print x
Next i
Print "它们的和是:"; s
定义一个Array,直接PUT和GET
小龙你的s永远等于1094