数学程序框图上WHILE WEND是什么意思
答案:2 悬赏:60 手机版
解决时间 2021-02-10 11:00
- 提问者网友:爱了却不能说
- 2021-02-10 03:44
数学程序框图上WHILE WEND是什么意思
最佳答案
- 五星知识达人网友:行路难
- 2021-02-10 05:17
While...Wend 语句 只要指定的条件为 True,则会重复执行一系列的语句
全部回答
- 1楼网友:过活
- 2021-02-10 06:14
显然因为c:\1.txt有2行(一般最后一行是空行)
看你的情况,应该是只用了第一行做存储。所以可以修改为:
if text1 = "" then
msgbox "please insert your password !", vbcritical, "login error"
text1.setfocus
call error2
else
open "c:\1.txt" for input as #1
line input #1, a '只读一行
if instr(1, a, text1.text) > 0 then
msgbox "ok"
else
msgbox "x"
end if
close #1
end if
您的意思是,文本文档里保存了不止一条;检查时候只要符合其中任意一条就出现ok;如果全部不符合才出现“x”么?
那么代码如下:
dim flag as boolean
if text1 = "" then
msgbox "please insert your password !", vbcritical, "login error"
text1.setfocus
call error2
else
flag=false
open "c:\1.txt" for input as #1
do until eof(1) '建议用do..loop,可以方便退出循环
line input #1, a
if instr(1, a, text1.text) > 0 then
flag=true '先标记一下
exit do '退出循环
end if
loop '循环直到文件末尾
if flag=false then '检查失败
msgbox "x"
else '检查成功
msgbox "ok"
end if
close #1
end if
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯