title: Sorting array in VB without using Sort Function
body: <p>I'm working on a sorting program where it takes inputs into an array. I already made Min, Max, and Average. Now I need to do Median, Mode and Sorting (Max to Min, and Min to Max). </p>
  
  <p>Here's the code I got for sorting [UPDATED New Code] </p>
  
  <pre><code>       RichTextBox1.Text = RichTextBox1.Text.Replace(" ", ",")
  
  
      marks = RichTextBox1.Text.Split(New String() {","}, StringSplitOptions.RemoveEmptyEntries)
      Label3.Text = Nothing
  
      Dim z As Integer = marks.Length - 1
      Dim y As Integer
      Dim TEMP As Integer
  
      For X = 1 To z
          For y = 1 To (z - 1)
  
              If marks(y) &gt; marks(y + 1) Then
                  TEMP = marks(y)
                  marks(y) = marks(y + 1)
                  marks(y + 1) = TEMP
  
              End If
              Label3.Text = Label3.Text &amp; vbCrLf &amp; marks(y)
          Next y
  
  
      Next X
  </code></pre>