|
-
Nov 26th, 2008, 07:03 PM
#1
Thread Starter
Junior Member
Max Value
Hey guys, new to the forums and new to visual basic
only been on visual basic for about 3 days now and im
stuck finding the highest value I've tryed a
few ways but It seems that it doesnt like to include
"Input2" and "input3" for example if I put
3 in Input 1
2 in Input 2
4 in Input 3
It will show 3 as the highest input and not 4 :/
anyways guys here is the code thanks in advanced
Private Sub Command1_Click()
Dim Max As Long
Dim Sum As Long
Sum = Val(input1.Text) + (input2.Text) + (input3.Text)
Label4.Caption = Sum
If Val(input1.Text) > Val(input2.Text) Then
Max = input1.Text
ElseIf Val(input1.Text) > Val(input3.Text) Then
Max = input1.Text
ElseIf Val(input3.Text) > Val(input1.Text) Then
Max = input3.Text
ElseIf Val(input2.Text) > Val(input1.Text) Then
Max = input2.Text
ElseIf Val(input2.Text) > Val(input3.Text) Then
Max = input2.Text
End If
Label5.Caption = Max
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|