VB - How to sort a list of numbers into descending order
<p>I'm making a frequency analysis tool for text using Visual Basic. The code below takes in an input from the user and then tells them how many of each letter appears in the text they inputted and that works fine. However, I'm struggling to order the letters into descending order.</p>

<pre><code>    Dim words, output
    Dim count = 0
    Dim letters As Array = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
    words = UCase(textInputBox.Text)
    For Each x In letters
        For Each i In words
            If x = i Then
                count = count + 1
            End If
        Next
        If count &lt;&gt; 0 Then
            output = output &amp; (x &amp; " = " &amp; count) &amp; vbCrLf
            textOutputBox.Text = output
            letterReplaceBox.Text = words
        End If
        count = 0
    Next
End Sub
</code></pre>

<p>For example, the input of the text:
HELLO
would output:
E = 1</p>

<p>H = 1</p>

<p>L = 2</p>

<p>O = 1</p>

<p>Is there anyway I can then order these into descending order? I'm thinking of trying a two dimensional array with the letters and the numbers and then ordering from there? Or adding the numbers all to a list? Or using something like bubble sort? Or is there a more efficient way to do it? I'm not sure how to approach it...</p>

<p>Thank you for any suggestions or help (:</p>