代码之家  ›  专栏  ›  技术社区  ›  Alex KeySmith

你能在vb脚本中使用常量吗?

  •  1
  • Alex KeySmith  · 技术社区  · 14 年前

    如果iTestVar为1,那么我希望触发DoStuff()。然而,它总是落在别人身上。

            'This is defined outside of the class (vbscript won't allow const inside classes)
            Const STOPHERECONSTANT = 1
    
    
            Select Case iTestVar
                Case STOPHERECONSTANT
    
                    DoStuff()
    
                Case Else
    
            End Select
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   Alex KeySmith    14 年前

    我的错,我确定我测试过这个,但我一定错过了,同时修复了其他东西。

    我需要转换iTestVar:

    'This is defined outside of the class (vbscript won't allow const inside classes)
        Const STOPHERECONSTANT = 1
    
    
        Select Case CInt(iTestVar)
            Case STOPHERECONSTANT
    
                DoStuff()
    
            Case Else
    
        End Select