VB总提示我文件模式错误?什么意思?在线等答案
PrivateSubC1_Click()Open"c:\wexam\26000026\in5.txt"ForInputAs#1Input#1,a%Text1.Text=a...
Private Sub C1_Click()
Open "c:\wexam\26000026\in5.txt" For Input As #1
Input #1, a%
Text1.Text = a%
Close #1
End Sub
Input #1, a% 就是这个总是错误 可是我不知道哪里有错误
Private Function isprime(a As Integer) As Boolean
Dim flag As Boolean
flag = True
b% = 2
Do While b% <= Int(a / 2) And flag
If Int(a / b%) = a / b% Then
flag = False
Else
b% = b% + 1
End If
Loop
isprime = flag
End Function
Private Sub C1_Click()
Open "c:\wexam\26000026\in5.txt" For Input As #1
Input #1, a%
Text1.Text = a%
Close #1
End Sub
Private Sub C2_Click()
Dim i As Integer
i = Text1.Text
Do
i = i + 1
Loop Until isprime(i) = True
Text2.Text = i
End Sub
Private Sub C3_Click()
Open "out5.txt" For Output As #1
Print #1, Text2.Text
Close #1
End Sub
这是整个程序、///、、、、 展开
Open "c:\wexam\26000026\in5.txt" For Input As #1
Input #1, a%
Text1.Text = a%
Close #1
End Sub
Input #1, a% 就是这个总是错误 可是我不知道哪里有错误
Private Function isprime(a As Integer) As Boolean
Dim flag As Boolean
flag = True
b% = 2
Do While b% <= Int(a / 2) And flag
If Int(a / b%) = a / b% Then
flag = False
Else
b% = b% + 1
End If
Loop
isprime = flag
End Function
Private Sub C1_Click()
Open "c:\wexam\26000026\in5.txt" For Input As #1
Input #1, a%
Text1.Text = a%
Close #1
End Sub
Private Sub C2_Click()
Dim i As Integer
i = Text1.Text
Do
i = i + 1
Loop Until isprime(i) = True
Text2.Text = i
End Sub
Private Sub C3_Click()
Open "out5.txt" For Output As #1
Print #1, Text2.Text
Close #1
End Sub
这是整个程序、///、、、、 展开
6个回答
展开全部
Private Sub C1_Click()
Open "c:\wexam\26000026\in5.txt" For Input As #1
if not eof(1) then '读文件时,要判断一下是否到了文件尾
Input #1, a '在不清楚变量类型时,可直接用变体弄变量
Text1.Text = a
end if
Close #1
End Sub
Open "c:\wexam\26000026\in5.txt" For Input As #1
if not eof(1) then '读文件时,要判断一下是否到了文件尾
Input #1, a '在不清楚变量类型时,可直接用变体弄变量
Text1.Text = a
end if
Close #1
End Sub
更多追问追答
追问
还是说 超出文件尾、、这个VB程序是不是有毛病啊。。怒了
追答
程序是没有错了.不知道你的那个文件是否有问题.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Input #1, a%
Text1.Text = a%
改为
Input #1, a$
Text1.Text = a$
Text1.Text = a%
改为
Input #1, a$
Text1.Text = a$
追问
说超出文件尾
追答
那是因为文件是空文件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim a as string
Open "c:\wexam\26000026\in5.txt" For Input As #1
line Input #1, a
Text1.Text = a
Close #1
Open "c:\wexam\26000026\in5.txt" For Input As #1
line Input #1, a
Text1.Text = a
Close #1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
定义要写在前面
dim a%
然后才是
Input #1, a
Text1.Text = a
dim a%
然后才是
Input #1, a
Text1.Text = a
更多追问追答
追问
我这样输了,可是这下它说我 输入超出文件尾。。
追答
dim a as string
Open "c:\wexam\26000026\in5.txt" For Input As #1
line Input #1, a
Text1.Text = a
Close #1
先试试这个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询