读书人

看IF方法怎样才能成立?该如何处理

发布时间: 2012-03-25 20:55:17 作者: rapoo

看IF方法怎样才能成立?
Text1="8" Combo1="=" Text2="8"
If Text1.Text & Combo1.Text & Text2.Text Then MsgBox "?????"
以上代码我测试不成立
用什么办法可以实现此功能
请高手指教。

[解决办法]
在Text1和Text2填入数字,Text3填入关系(=、>、<、>=、<=、<>)
Text4输出比较结果

VB code
Private Sub Command1_Click()  Dim tCheck As Boolean  Dim tOutBool As Boolean  tCheck = IsNumeric(Text1.Text) And IsNumeric(Text2.Text)  If tCheck Then    tOutBool = (InStr(Text3.Text, "=") And CLng(Text1.Text) = CLng(Text2.Text)) Or (InStr(Text3.Text, ">") And CLng(Text1.Text) > CLng(Text2.Text)) Or (InStr(Text3.Text, "<") And CLng(Text1.Text) < CLng(Text2.Text))  End If  Text4.Text = tOutBoolEnd Sub 

读书人网 >VB

热点推荐