• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

another VB Express 2005 problem

BALIstik916

Senior member
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?
 
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
 
Back
Top