I am developing an application which I have added 2 combobox's (possibly not the best way but it works fine in the most part) which I import data into from a CSV file.
I have added code in so that users can add to this file, again this works fine. However I cannot get the "linked" combobox's to sort correctly.
Here is the code:
Dim WebLinks = (From line In IO.File.ReadAllLines("C:\Test\URLList.csv") _
Where line.Length > 0 _
Let Items = line.Split(","c) _
Select New With _
{.URLName = Items(0), _
.URLLoc = Items(1) _
} _
).ToList
For Each URLSCut In WebLinks
Console.WriteLine("[{0} [{1}]", _
URLSCut.URLName, _
URLSCut.URLLoc _
)
Next
PageName.DataSource = WebLinks
PageName.DisplayMember = "URLName"
WebAdd.DataSource = WebLinks
WebAdd.DisplayMember = "URLLoc"
If I then set PageName (aka ComboBox1) to "Sorted = Yes" on the combobox itself the 2 fall out of sequence. I only want to sort on PageName / ComboBox1.
Is there any way I can get it to sort either on import or once imported? Because I want the list to appear alphabetically, but don't want to have to manually sort it.
I've tried using .Sorted etc, but they give various errors or are non-functional.
Any advice greatfully received.