紧急求助!如何把data.dat 文件读入数组?(正文会给出该文件)
是编一个银行查询系统用的。
要求:按“打开“(”文件“菜单下的)打开data.dat,把它读入数组。然后用它查询帐户的余额(在文本框内输入帐号)。并统计总余额和帐户数(是不是通过ubound找到数组的下界呀?能不能教教我具体的程序呀)。最后再把帐户信息保存到磁盘)。
ps;data文件中有空的
我编的程序;
Option Base 1
Dim x(), i%, j%
Private Sub about_Click()
Form2.Show
End Sub
Private Sub cx_Click()
Text1.Text , a()
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
Label1.Alignment = 1
Label1.Caption = "请输入帐号"
Label1.FontSize = 10
Text1.Text = ""
End Sub
Private Sub open_Click()
Dim FilePath As String
Dim FileText As String
CommonDialog1.Filter = "文本文件(*.dat)|*.dat"
CommonDialog1.Action = 1
CommonDialog1.DialogTitle = "打开 "
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
FilePath = CommonDialog1.FileName
Form1.Caption = Form1.Caption
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then cx.SetFocus
End Sub
Private Sub zhongzh_Click()
MsgBox "总帐户数为" & zhs(a())
End Sub
Private Sub zye_Click()
总余额为 "&zye(a())"
End Sub
半成品在下面的压缩文件
复件 实验.rar
(17.59 KB)