VB比较大小的问题!!
来源:百度知道 编辑:UC知道 时间:2024/06/05 01:39:47
这么做有啥问题?
我用了之后全部对话框清空……
Private Sub Command1_Click()
Text1.Text = a
Text2.Text = b
If a > b Then
Text3.Text = a
Else
Text3.Text = b
End If
End Sub
我用了之后全部对话框清空……
Private Sub Command1_Click()
Text1.Text = a
Text2.Text = b
If a > b Then
Text3.Text = a
Else
Text3.Text = b
End If
End Sub
是比较Text1和Text2吧?写倒了。
你的是把Text1和Text2设置为暂时为空的a和b
正确的:
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
If a > b Then
Text3.Text = a
Else
Text3.Text = b
End If
End Sub
Private Sub Command1_Click()
Text1.Text = a
Text2.Text = b
If a > b Then
Text3.Text = a
Else
Text3.Text = b
End If
End Sub
再建一个命令按扭
text1.text=""
text2.text=""
text3.text=""
不就全部清空了吗
语法对吗?
看的意思是想取文本框的值赋给a,b然后比较a,b
我不懂vb但好像反了吧
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
If a > b Then
Text3.Text = a
Else
Text3.Text = b
End If
End Sub