Hey Everyone, I'm stuck... I've got a 1-dimensional array from a text file that is displaying in a list box. I have buttons to sort ascending and descending but cannot seem to get them to work. My code for the array is
Dim name() As String = IO.File.ReadAllLines("Countries.txt")
lstCountries.Items.AddRange(name)
This code is successfully populating the listbox at launch. I've tried to pass this to the subs for the buttons when clicked are to sort and been unsuccessful so I have the original line in the subroutine as well. The code I've written to sort sub is:
Dim name() As String = IO.File.ReadAllLines("Countries.txt")
Dim sortdown = From var In name
Order By name Descending
For Each var As String In sortdown
Next
lstCountries.Items.Clear()
lstCountries.Items.AddRange(name)
End Sub
Its not working at all. It clears the listbox and repopulates the alphabetical list as originally placed in the box. I have made sure that the listbox sorting is turned off as well.
Any help would be greatly appreciated. I feel like I'm on the right track but missing something.