Board logo

标题: [问题求助] [已解决]]VBS的inputbox返回值为何出错? [打印本页]

作者: batsealine    时间: 2013-5-8 15:46     标题: [已解决]]VBS的inputbox返回值为何出错?

本帖最后由 batsealine 于 2013-5-8 20:53 编辑
  1. Dim a,b,c
  2. a=InputBox("输入")
  3. b=InputBox("输入")
  4. c=InputBox("输入")
  5. If a=b+c Then MsgBox("yes") Else MsgBox("no")
复制代码
你输入3、2、1,总是返回no,为什么
  1. Dim a,b,c
  2. a=3
  3. b=2
  4. c=1
  5. If a=b+c Then MsgBox("yes") Else MsgBox("no")
复制代码
这个会返回yes
作者: Demon    时间: 2013-5-8 16:15

http://demon.tw/programming/vbs-add-two-number.html

InputBox的返回值是字符串类型
作者: czjt1234    时间: 2013-5-8 18:01

哈哈,果然
  1. Dim a,b,c
  2. a=InputBox("输入")
  3. b=InputBox("输入")
  4. c=InputBox("输入")
  5. If 0+a=0+b+c Then
  6.     MsgBox("yes")
  7. Else
  8.     MsgBox("no")
  9. end if
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2