你好像是查询abcd四个数的最大数,你使用的这个方法不理想,在VB中一般使用排序进行判断,排序是将数据存储在数组中,你的程序可以定义一个数组,然后进行排序:
Private Sub Command1_Click()
Dim a(1 To 4) As Single,x As Single
a(1) = Val(Text1.Text):a(2) = Val(Text2.Text):a(3) = Val(Text3.Text):a(4) = Val(Text4.Text)
For i = 1 To 3
For j = 1 To 4 - i
If a(j) < a(j + 1) Then
x = a(j)
a(j) = a(j + 1)
a(j + 1) = x
End If
Next j
Next i
Text5.Text = "最大值是:" & CStr(a(1)) & ",最小值是:" & CStr(a(4))
End Su