在VB里怎样实现
    Dim str As String
    str = "1>0"
    If str Then
        MsgBox str
    End If
''''''''''
private function GetStr(...)
.......    
end func
因为,这个str我想要用一个函数返回判断的串,避免在每个程序段里面写这个str,提高点程序的质量.
但是,为什么VB就不行呢?
有别的办法实现吗?

解决方案 »

  1.   


    Private Sub Command1_Click()
        Dim str As String
        str = 1 > 0
        If CBool(str) Then
            MsgBox str
        End If
    End Sub
      

  2.   

    添加Microsoft Script Control 1.0控件
    Private Sub Command1_Click()
        Dim mm As String
        mm = "20>30"
        If ScriptControl1.Eval(mm) Then
                txtoutput.Text = "True"
             Else
                txtoutput.Text = "False"
            End If
    End Sub
      

  3.   

    可以這樣寫函數
    private function GetStr(ss as string) as boolean
        if ss=?XX then  '等於什麼值時,返回真
             getstr=true
        end if    if ss=?YY then '等於什麼值時,返回假
             getstr=false
        end if 
    end func