VB怎么判断连续5个数的大小

来源:百度知道 编辑:UC知道 时间:2024/06/22 05:29:16
假设有5个数字,分别对应5个 text框,怎么判断if text1<text2<text3<text4<text5,则msgbox提示报错

if text1.text<text2.text and text2.text<text3.text andtext3.text<text4.text and text4.text<text5.text then
msgbos "错误"
end if

if val(text1)<val(text2) and val(text2)<val(text3) and val(text3)<val(text4) and val(text4)<val(text5) then
msgbox提示报错
end if

If CDbl(Text1.Text)<CDbl(Text2.Text) and CDbl(Text2.Text)<CDbl(Text3.Text) and CDbl(Text3.Text)<CDbl(Text4.Text) and CDbl(Text4.Text)<CDbl(Text5.Text) Then
Msgbox "错误"
End If