VB中文件运行超出文件尾是怎么回事,我是新手,求大神指导
窗体出错代码,每次都是在Inptu#1出错,另外几段也是那出错,我改不来0.0Private Sub Command3_Click() '添加记录
Dim j As Integer
ReDim stu(1 To counter + 1) As student
msg0$ = "添加"
msg1$ = InputBox("请输入所要添加的学号:", msg0$)
msg2$ = InputBox("请输入所要添加的姓名:", msg0$)
msg3$ = InputBox("请输入所要添加记录照片的存储路径:", msg0$)
Open "H:\哈哈\程序相关\资料.dat" For Input As #1
For i = 1 To counter
Input #1, stu(i).card, stu(i).name, stu(i).易做图, stu(i).mz, stu(i).zzmm, stu(i).qs, stu(i).bj, stu(i).phone, stu(i).jg, stu(i).gkcj, stu(i).gfs, stu(i).drzw, stu(i).byzx, stu(i).jtzz, stu(i).lxr, stu(i).yb, stu(i).lxdh, stu(i).ksh, stu(i).sfzh, stu(i).bz
Next i
Close #1
For i = 1 To counter
If stu(i).name = msg1$ Then
MsgBox ("学号重复,添加失败,请检验。")
j = 1
Exit Sub
End If
If msg1$ = "" Then
MsgBox ("学号不能为空,添加失败,请检验。")
j = 1
Exit Sub
End If
Next i
msg$ = "H:\哈哈\程序相关\图片\" + msg1$ + ".ico"
FileCopy msg3$, msg$
counter = counter + 1
Kill "H:\哈哈\程序相关\counter.dat"
Open "H:\哈哈\程序相关\counter.dat" For Output As #1
Write #1, counter
Close #1
下面是模块的代码:
Public counter As Integer '记录的个数
Public Type student
card As String
name As String
易做图 As String
mz As String
zzmm As String
qs As String
bj As String
phone As String
jg As String
gkcj As String
gfs As String
drzw As String
byzx As String
jtzz As String
lxr As String
yb As String
lxdh As String
ksh As String
sfzh As String
bz As String
End Type
Public fform As Integer
Public flag As Integer 'form2、form4的enabled属性的判别
Public cx As Integer '查询方式的开关变量
--------------------编程问答--------------------
Open "H:\哈哈\程序相关\资料.dat" For Input As #1
For i = 1 To counter
if not EOF(1) then
Input #1, stu(i).card, stu(i).name, stu(i).易做图, stu(i).mz, stu(i).zzmm, stu(i).qs, stu(i).bj, stu(i).phone, stu(i).jg, stu(i).gkcj, stu(i).gfs, stu(i).drzw, stu(i).byzx, stu(i).jtzz, stu(i).lxr, stu(i).yb, stu(i).lxdh, stu(i).ksh, stu(i).sfzh, stu(i).bz
Next i
else
exit for
endif
Close #1
补充:VB , 非技术类