输入成绩 按钮代码
Private Sub Command1_Click()
Dim cj(50)
For a = 1 To 50
cj(a) = InputBox("请输入第个学生成绩:")
Open "d:\cj.txt" For Append As #1
Print #1, cj(a)
Close #1
Next
End Sub
计算 按钮代码
Private Sub Command3_Click()
Dim s
If Dir("d:\cj.txt") = "" Then
MsgBox "文件不存在,请先输入成绩!", 64, "提示"
Else
Open "d:\cj.txt" For Input As #1
Do While Not EOF(1) '如果没读到最后一行则循环
Line Input #1, s
result = Val(result) + Val(s)
Loop
Close #1
MsgBox result
End If
End Sub
第二个按钮 代码 暂时没有
就是个读写txt文件的操作啊