Sunday, December 9, 2012

Find greatest and smallest number between three numbers in visual basic.


Dim i, j, r As Integer
Private Sub Cmdgtr_Click()
i = Val(Txtnum1.Text)
j = Val(Txtnum2.Text)
r = Val(Txtnum3.Text)
If (i> j) And (i> r) Then
MsgBox "num1 is greater"
ElseIf (j >i) And (j > r) Then
MsgBox "num2 is greater"
Else
MsgBox "num3 is greater"
End If
End Sub
Private Sub CmdExit_Click()
End
End Sub





 Output
Note:- Please set some property of your control like caption or id corresponding to your control