vb中怎么将textBox里的值比较

来源:百度知道 编辑:UC知道 时间:2024/06/28 16:19:52

1)数值比较:
If Val(Text1) > Val(Text2) Then
'写执行句
ElseIf Val(Text1) < Val(Text2) Then
'写执行句
ElseIf Val(Text1) <> Val(Text2) Then
'写执行句
ElseIf Val(Text1) = Val(Text2) Then
'写执行句
End If
2)字符串比较:
If Text1 > Text2 Then
'写执行句
ElseIf Text1 < Text2 Then
'写执行句
ElseIf Text1 <> Text2 Then
'写执行句
ElseIf Text1 = Text2 Then
'写执行句
End If

说的比较模糊,你是想怎么样比较?
直接就textBox1.text>textBox2.text就可以的

直接用TEXT1.VLAUE比较