vb 实时错误‘53’ 文件未找到
PrivateSubC1_Click()Dimnumber(1To10)AsIntegerDimiAsIntegerOpen"F:\vb\in.txt"ForInputA...
Private Sub C1_Click()
Dim number(1 To 10) As Integer
Dim i As Integer
Open "F:\vb\in.txt" For Input As #1
For i = 1 To 10
Input #1, number(i)
Next
Close #1
For i = 1 To 10
a$ = a$ + Str(number(i)) + " "
Next
Text1.Text = a$
End Sub 展开
Dim number(1 To 10) As Integer
Dim i As Integer
Open "F:\vb\in.txt" For Input As #1
For i = 1 To 10
Input #1, number(i)
Next
Close #1
For i = 1 To 10
a$ = a$ + Str(number(i)) + " "
Next
Text1.Text = a$
End Sub 展开
3个回答
展开全部
'没有in.txt,可以再Open "F:\vb\in.txt" For Input As #1前加个判断
Private Sub C1_Click()
Dim number(1 To 10) As Integer
Dim i As Integer
If Dir("F:\vb\in.txt", 7) <> "" Then
Open "F:\vb\in.txt" For Input As #1
For i = 1 To 10
Input #1, number(i)
Next
Close #1
For i = 1 To 10
a$ = a$ + Str(number(i)) + " "
Next
Text1.Text = a$
Else
Open "F:\vb\in.txt" For Output As #1 '没有的话,创建一个
Print #1, "aaa"
Close #1
End If
End Sub
Private Sub C1_Click()
Dim number(1 To 10) As Integer
Dim i As Integer
If Dir("F:\vb\in.txt", 7) <> "" Then
Open "F:\vb\in.txt" For Input As #1
For i = 1 To 10
Input #1, number(i)
Next
Close #1
For i = 1 To 10
a$ = a$ + Str(number(i)) + " "
Next
Text1.Text = a$
Else
Open "F:\vb\in.txt" For Output As #1 '没有的话,创建一个
Print #1, "aaa"
Close #1
End If
End Sub
追问
我在F:\vb里有in.txt文件,按理说应该能读吧,可是就是错误
追答
但问题就是没有文件啊= =,你再仔细看下,或者我的代码你试过吗?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Open "F:\vb\in.txt" For Input As #1
在"F:\vb\"目录必须有 "in.txt" 文件
在"F:\vb\"目录必须有 "in.txt" 文件
追问
我在F:\vb里有in.txt文件,按理说应该能读吧,可是就是错误
追答
注意中文与英文,全角与半角.......
实在不行,就从地址栏复制文件地址,如图:
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
F:\vb\in.txt 是不是这个文件不存在?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询