another VB Express 2005 problem

BALIstik916

Senior member
Jan 28, 2007
755
0
71
i have a general question...

if you were to compare 3 numbers and then order them

say int1, int2, int3...and then display them into a Messagebox in order from smallest to greatest. Pretty much I use a series of If Then statements to compare the various cases that could occur (ex: int2 > int3 > int1, int3 > int2 > int1) and then assign the greatest value to a variable N1, the second largest a variable N2, and the smallest a variable N3. All Ive done is declare the N1, N2, N3 as Integers....However it seems that it keeps giving me values of zero, what am I doing wrong?
 

formulav8

Diamond Member
Sep 18, 2000
7,004
523
126
Hi, I am not 100% sure exactly what you want, but I tried anyways :) Maybe the code below will help get you started?

'
Dim int1 As Integer = 10
Dim int2 As Integer = 555
Dim int3 As Integer = 1000
'
'Int3 = highest, int1 = smallest
If int3 > int2 And int2 > int1 Then

MessageBox.Show("INT3 = Largest: " & int3.ToString & vbNewLine & "INT2 = Next: " & int2.ToString & vbNewLine & "INT1 = Smallest: " & int1.ToString, " Largest to Smallest")

End If




Jason