如题

解决方案 »

  1.   

    dim a as boolean
    if a=true then
       '
    else
       '
    end if
      

  2.   

    dim a as booleanmsgbox typename(a)
      

  3.   

    dim a as boolean
    if typename(a)="boolean" then
         msgbox "a是布尔型变量"
    endif
      

  4.   

    我的意思是是否有类似IsDate来判断日期型变量,IsNumeric来判断数值型变量,的一个函数来判断布尔型变量.
      

  5.   

    vb里面没有这样的函数,我觉得lxcc(虫莲) 的方法已经满足你的要求了
      

  6.   

    Private Function IsBoolean(a As Variant) As Boolean
        If TypeName(a) = "Boolean" Then
            IsBoolean = True
        Else
            IsBoolean = False
        End If
    End FunctionPrivate Sub Command1_Click()
        Dim a As Boolean
        a = False
        If IsBoolean(a) = True Then
            MsgBox "a是布尔型变量"
        End If
    End Sub
      

  7.   

    比如说"True"这样的字符,用什么能够检测出他可以转化成Boolean值,就象"2002-12-12"这样的字符串,可以转化成Date值,当时在用cDate转化成Date值之前,可以用IsDate函数进行判断。而cBoolean对应的函数却没有。看来只能用On error 来做了
      

  8.   

    有CBool
    Private Sub Command1_Click()
        Dim a As String
        a = "true"
        MsgBox CBool(a)
    End Sub
      

  9.   

    我是说IsBool没有!!!不过谢谢!!!分马上就送