当我运行以下代码段并输入可接受的值时,我得到了所需的结果。
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
条件中包含备注),并再次运行代码段,我会触发相应的if
条件,但do
循环继续,而不是退出。
我已经尝试在循环条件下使用isnumeric
and ,但没有任何乐趣......我错过了什么让该死的东西退出循环?cstr
do
strselect