
This program let users input three hidden numbers and the program can find out the maximum number. In order to set the textbox in password mode, you have to set the PasswordChar to alphanumeric symbols such as * . The program created a function calMax with three parameters x,y, z and then uses a procedure to call this function. It uses a simple If Then ElseIf statements to determine the maxmum number. The function Str is used to convert a numeric to string.
Function calMax(x, y, z As Variant)
If x > y And x > z Then
calMax = Str(x)
ElseIf y > x And y > z Then
calMax = Str(y)
ElseIf z > x And z > y Then
calMax = Str(z)
End If
End Function
Private Sub Command1_Click()
Dim a, b, c
a = Val(Txt_Num1.Text)
b = Val(Txt_Num2.Text)
c = Val(Txt_Num3.Text)
Lbl_Display.Caption = calMax(a, b, c)
End Sub
Private Sub Label5_Click()
End Sub
Private Sub Form_Load()
End Sub