表單設計如下:
使用物件: text1,text2,text3,command1,label1,form1
程式碼如下:
Private Sub Command1_Click()
'輸入三數
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
'判斷最大數為何者
If a > b Then
If a > c Then
Max = a
Else
Max = c
End If
Else
If b > c Then
Max = b
Else
Max = c
End If
End If
'輸出最大數
Label1.Caption = Max
End Sub