正在验证inputbox中的用户输入

正在验证inputbox中的用户输入,input,vbscript,inputbox,validating,Input,Vbscript,Inputbox,Validating,当我运行以下代码段并输入一个可接受的值时,我得到了所需的结果 do while len(strselect) = 0 'or strselect<>"1" or strselect<>"2" or strselect<>"3" strselect = inputbox ("Please select:" &vbcrlf&vbcrlf&_ "1. Add an entry" &vbcrlf&vbcrlf&_

当我运行以下代码段并输入一个可接受的值时,我得到了所需的结果

do while len(strselect) = 0  'or strselect<>"1" or strselect<>"2" or strselect<>"3"
strselect = inputbox ("Please select:" &vbcrlf&vbcrlf&_  
"1. Add an entry" &vbcrlf&vbcrlf&_  
"2. Remove an entry" &vbcrlf&vbcrlf&_  
"3. Search for an entry" &vbcrlf, "Contact Book")
if isempty(strselect) then
wscript.quit()
elseif strselect="1" then
wscript.echo "You chose 1"
elseif strselect="2" then
wscript.echo "You chose 2"
elseif strselect="3" then
wscript.echo "You chose 3"
end if
loop
do while len(strselect)=0'或strselect“1”或strselect“2”或strselect“3”
strselect=inputbox(“请选择:”&vbcrlf&vbcrlf&\u
“1.添加条目”&vbcrlf&vbcrlf&\u
“2.删除条目”&vbcrlf&vbcrlf&\u
“3.搜索条目”&vbcrlf,“联系人簿”)
如果我是空的(strselect),那么
wscript.quit()
elseif strselect=“1”则
wscript.echo“您选择了1”
elseif strselect=“2”则
wscript.echo“您选择了2”
elseif strselect=“3”则
wscript.echo“您选择了3”
如果结束
环
但是,如果我尝试进一步约束验证过程(通过在
do while
条件中包含注释),并再次运行代码段,我会触发相应的
if
条件,但
do
循环将继续,而不是退出


我尝试在
do
循环
strselect
条件下使用
isnumeric
cstr
,但毫无乐趣。。。我缺少什么来让该死的东西退出循环?

您在条件中的逻辑有问题

         condition 1            condition 2       condition 3       condition 4
         v----------------v     v------------v    v------------v    v............v
do while len(strselect) = 0  or strselect<>"1" or strselect<>"2" or strselect<>"3"
Do While strselect<>"1" And strselect<>"2" And strselect<>"3"
Do While Not (strselect="1" Or strselect="2" Or strselect="3")
....

您对条件中的逻辑有问题

         condition 1            condition 2       condition 3       condition 4
         v----------------v     v------------v    v------------v    v............v
do while len(strselect) = 0  or strselect<>"1" or strselect<>"2" or strselect<>"3"
Do While strselect<>"1" And strselect<>"2" And strselect<>"3"
Do While Not (strselect="1" Or strselect="2" Or strselect="3")
....

非常感谢MC ND,很好地说明了答案。我的错误现在很清楚了,就像昨晚令人沮丧的无法确定一样。我将修改我的逻辑运算符和逻辑!后匆忙。。。再次感谢!:)非常感谢MC ND,很好地说明了答案。我的错误现在很清楚了,就像昨晚令人沮丧的无法确定一样。我将修改我的逻辑运算符和逻辑!后匆忙。。。再次感谢!:)