小菜鸟急需您的帮助!(vbs)

来源:百度知道 编辑:UC知道 时间:2024/05/16 14:56:43
do
num=inputbox("请输入算式","vbs计算器")
If num=False then
MsgBox eval(num)
MsgBox "请输入正确的算式"
end if
loop
每次运行这个vbs都出错

----------
Set sc = CreateObject("ScriptControl")
do
num=inputbox("请输入算式","vbs计算器")
if num="" then exit do
sc.Language = "VBScript"
if sc.Eval(num) then
msgbox sc.Eval(num),0,"计算结果"
else
MsgBox "请输入正确的算式"
end if
loop
----------
点击“取消”或不输入则退出程序,支持+-*/及括号的四则运算.~!

哦jadmg amjuadmtmadg+jamgtdj

If num=False then
为什么要写这一句呢?

改为
do
num=inputbox("请输入算式","vbs计算器")
MsgBox eval(num)
If num=False then
MsgBox "请输入正确的算式"
end if
loop

do
num=inputbox("请输入算式","vbs计算器")
If num="" then '输入为空提示
MsgBox "请输入正确的算式"
else '否则计算
MsgBox eval(num)
end if
loop