Click here to Skip to main content
15,891,473 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: vb.net desk app using app.config file Pin
Dave Kreskowiak5-Jun-18 8:11
mveDave Kreskowiak5-Jun-18 8:11 
QuestionInserting to new table in between two table in ms word from vb.net Pin
Osioghole Clifford28-May-18 13:50
Osioghole Clifford28-May-18 13:50 
QuestionLINQ: How To Make Order By Conditional? Pin
Alan Burkhart26-May-18 16:05
Alan Burkhart26-May-18 16:05 
AnswerRe: LINQ: How To Make Order By Conditional? Pin
Richard MacCutchan27-May-18 1:05
mveRichard MacCutchan27-May-18 1:05 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Alan Burkhart29-May-18 14:42
Alan Burkhart29-May-18 14:42 
AnswerRe: LINQ: How To Make Order By Conditional? Pin
Richard Deeming30-May-18 9:58
mveRichard Deeming30-May-18 9:58 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Mycroft Holmes30-May-18 14:27
professionalMycroft Holmes30-May-18 14:27 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Richard Deeming31-May-18 1:15
mveRichard Deeming31-May-18 1:15 
You could always create your own extension method. Smile | :)
VB.NET
Module SortingExtensions
    <Extension()> 
    Public Function OrderBy(Of TElement, TKey)(
        ByVal source As IEnumerable(Of TElement), 
        ByVal selector As Func(Of TElement, TKey), 
        ByVal sortDescending As Boolean) _
        As IOrderedEnumerable(Of TElement)
        
        Return If(sortDescending, source.OrderByDescending(selector), source.OrderBy(selector))
    End Function
    
    <Extension()> 
    Public Function ThenBy(Of TElement, TKey)(
        ByVal source As IOrderedEnumerable(Of TElement), 
        ByVal selector As Func(Of TElement, TKey), 
        ByVal sortDescending As Boolean) _
        As IOrderedEnumerable(Of TElement)
        
        Return If(sortDescending, source.ThenByDescending(selector), source.ThenBy(selector))
    End Function
End Module

...

Dim fileItem = itemList.Where(Function (files) files.Tag(0) = "file").OrderBy(Function (files) files.SubItems.Item(indx).Text, shouldSortDescending)

There's no option to extend the query syntax though.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: LINQ: How To Make Order By Conditional? Pin
Alan Burkhart31-May-18 7:18
Alan Burkhart31-May-18 7:18 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Alan Burkhart31-May-18 7:33
Alan Burkhart31-May-18 7:33 
QuestionWebBrowser Javascript Error handing via HtmlWindow works in IE8 mode but not in IE10 or Edge. Pin
Jeffrey Cobb26-May-18 15:55
Jeffrey Cobb26-May-18 15:55 
QuestionOutlook Mail Drag Drop into Textbox of a Win Form Pin
HPS-Software24-May-18 18:41
HPS-Software24-May-18 18:41 
AnswerRe: Outlook Mail Drag Drop into Textbox of a Win Form Pin
Richard Deeming25-May-18 2:35
mveRichard Deeming25-May-18 2:35 
GeneralRe: Outlook Mail Drag Drop into Textbox of a Win Form Pin
HPS-Software26-May-18 20:51
HPS-Software26-May-18 20:51 
GeneralRe: Outlook Mail Drag Drop into Textbox of a Win Form Pin
Eddy Vluggen26-May-18 23:05
professionalEddy Vluggen26-May-18 23:05 
GeneralRe: Outlook Mail Drag Drop into Textbox of a Win Form Pin
HPS-Software27-May-18 18:14
HPS-Software27-May-18 18:14 
QuestionSave in datagriedview in application Pin
Member 1361197220-May-18 8:13
Member 1361197220-May-18 8:13 
AnswerRe: Save in datagriedview in application Pin
Dave Kreskowiak20-May-18 11:40
mveDave Kreskowiak20-May-18 11:40 
GeneralRe: Save in datagriedview in application Pin
Member 1361197221-May-18 1:26
Member 1361197221-May-18 1:26 
AnswerRe: Save in datagriedview in application Pin
Richard Deeming21-May-18 2:11
mveRichard Deeming21-May-18 2:11 
GeneralRe: Save in datagriedview in application Pin
Member 1361197222-May-18 6:00
Member 1361197222-May-18 6:00 
QuestionWhat am I missing with Clone()? Pin
mo149218-May-18 13:48
mo149218-May-18 13:48 
AnswerRe: What am I missing with Clone()? Pin
Eddy Vluggen18-May-18 14:03
professionalEddy Vluggen18-May-18 14:03 
GeneralRe: What am I missing with Clone()? Pin
mo149218-May-18 14:10
mo149218-May-18 14:10 
GeneralRe: What am I missing with Clone()? Pin
Eddy Vluggen18-May-18 14:13
professionalEddy Vluggen18-May-18 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.