Public Class Form1 Dim temp As String Dim vegetable() As String = {"tomato", "carrot", "celery", _ "beet", "parsley", "lettuce", "water-cress", "spinach"} Dim U As Integer = vegetable.GetUpperBound(0) Dim L As Integer = vegetable.GetLowerBound(0) Dim i As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAsc.Click 'Dim b As Integer 'Ascending Order lstOutputA.Items.Clear() 'clear the box every time the box is clicked so it doesn't scroll forever For i = 0 To 6 'total of 7 times, n-1 For L = 0 To U 'lower bound is always 0, to upper bound If (L + 1) < U Then 'make sure that we won't get an "out of bound" error. Check here, so it doesn't get a chance to make an error. (Used for checking last time (when L = 8 (when counting from 0)) If vegetable(L) > vegetable(L + 1) Then 'if the first value is NOT in ascending alphabetical order with the second, do stuff temp = vegetable(L) 'the three step switch (Nice ring to it, I came up with that) vegetable(L) = vegetable(L + 1) vegetable(L + 1) = temp End If End If Next Next For i = 0 To U 'display the first (lowerBound (which is 0) to the last UpperBound (which is 7)) lstOutputA.Items.Add(vegetable(i)) Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDesc.Click 'Descending lstOutputD.Items.Clear() 'clear the box every time the box is clicked so it doesn't scroll forever For i = 0 To 6 'total of 7 times, n-1 For L = 0 To U 'lower bound is always 0, to upper bound If (L + 1) < U Then 'make sure that we won't get an "out of bound" error. Check here, so it doesn't get a chance to make an error. (Used for checking last time (when L = 8 (when counting from 0)) If vegetable(L) < vegetable(L + 1) Then 'if the first value is NOT in descending alphabetical order with the second, do stuff temp = vegetable(L) 'the three step switch (Nice ring to it, I came up with that) vegetable(L) = vegetable(L + 1) vegetable(L + 1) = temp End If End If Next Next For i = 0 To U 'display the first (lowerBound (which is 0) to the last UpperBound (which is 7)) lstOutputD.Items.Add(vegetable(i)) Next End Sub End Class