I need to sort three numbers that are entered in 10 different textboxes and display these numbers ascending and when I press a different button display them descending. Now I think that I need to put these three numbers into an array, sort and display, but I'm not really too proficient in code to accomplish this. Is there a way to do this without putting them into an Array. Here is my code so far? Which is not much of anything so far. Any guidance would be greatly appreciated, Thanks in advance.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str1 As String = TextBox1.Text
Dim str2 As String = TextBox2.Text
Dim str3 As String = TextBox3.Text
Dim str4 As String = TextBox4.Text
Dim str5 As String = TextBox5.Text
Dim str6 As String = TextBox6.Text
Dim str7 As String = TextBox7.Text
Dim str8 As String = TextBox8.Text
Dim str9 As String = TextBox9.Text
Dim str10 As String = TextBox10.Text
RichTextBox1.Text = ""
Dim db1 As Double
Dim db2 As Double
Dim db3 As Double
Dim db4 As Double
Dim db5 As Double
Dim db6 As Double
Dim db7 As Double
Dim db8 As Double
Dim db9 As Double
Dim db10 As Double
If IsNumeric(db1) Then
db1 = Double.Parse(str1)
ElseIf IsNumeric(db2) Then
db2 = Double.Parse(str2)
ElseIf IsNumeric(db3) Then
db3 = Double.Parse(str3)
ElseIf IsNumeric(db4) Then
db4 = Double.Parse(str4)
ElseIf IsNumeric(db5) Then
db5 = Double.Parse(str5)
ElseIf IsNumeric(db6) Then
db6 = Double.Parse(str6)
ElseIf IsNumeric(db7) Then
db4 = Double.Parse(str7)
ElseIf IsNumeric(db8) Then
db5 = Double.Parse(str8)
ElseIf IsNumeric(db9) Then
db6 = Double.Parse(str9)
ElseIf IsNumeric(db10) Then
db6 = Double.Parse(str10)
End If
RichTextBox1.Text += "Before Sorting" + vbCrLf
RichTextBox1.Text += str1 & " "
RichTextBox1.Text += str2 & " "
RichTextBox1.Text += str3 & " "
RichTextBox1.Text += str4 & " "
RichTextBox1.Text += str5 & " "
RichTextBox1.Text += str6 & " "
RichTextBox1.Text += str7 & " "
RichTextBox1.Text += str8 & " "
RichTextBox1.Text += str9 & " "
RichTextBox1.Text += str10 & " "
RichTextBox1.Text += vbCrLf
RichTextBox1.Text += "After Sorting" + vbCrLf