Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to Visual basic and still in the process of learning all of the ins and outs of this language. I'm struggling with trying to get what's already in my lstbox that was read in from a text file to sort in Ascending and Descending order from using an dropdown menu. I've done this with Radio buttons, but they were on a datagrid and for some odd reason my code isn't doing anything this time.

What I have tried:

Dim ascNames() As String = IO.File.ReadAllLines("file.txt")

Dim ascQuery = From asc In ascNames
Order by ascName.Lendth Ascending, ascName Descending
Posted
Updated 24-Apr-18 2:09am

Issues are underlined:
VB
Dim ascQuery = From asc In ascNames
Order by ascName.Lendth Ascending, ascName Descending
...

wouls rather be
VB
Dim ascQuery = From asc In ascNames
               Order By asc.Length Ascending, asc Descending
               Select asc

- Variable name is asc, its type is string.
- It is sorted by ascending length (Length property of string object) and descending value.
- There must be a Select statement.

Kindly.
 
Share this answer
 
Comments
Maciej Los 24-Apr-18 7:23am    
+5!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900