Question Ordering

TommyEvans

Active member
Joined
Feb 19, 2010
Messages
39
Programming Experience
Beginner
I need to develop a program (of course.) I need it so the user has 3 text boxes, and puts a number into each text box. Then, there be a group with 2 radio buttons.
1st Radio Button: Least to Greatest
2nd Radio Button: Greatest to Least

When the press calculate, it preforms the correct operation, depending on the radio button click.

I just need to know how to make it so it will order from least to greatest. I then can do the rest.

Any help? :S

2dw4xzl.gif
 
Get the numbers from the texts into an array, sort the array, set the new texts:
VB.NET:
Try
    Dim nums() As Integer = {CInt(tb1.Text), CInt(tb2.Text), CInt(tb3.Text)}
    Array.Sort(nums)
    tb1.Text = nums(0).ToString
    tb2.Text = nums(1).ToString
    tb3.Text = nums(2).ToString
Catch ex As Exception
    MessageBox.Show(ex.Message)
End Try
 
Back
Top