Results 1 to 35 of 35

Thread: [vb.net] Sorting decimal in ascending order in richtextbox

Hybrid View

  1. #1
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: [vb.net] Sorting decimal in ascending order in richtextbox

    Quote Originally Posted by matty95srk View Post
    Hey Paul, unfortunately it gives me the same error


    no blanklines
    The blank lines cause the error. You have to filter those out:-
    Code:
            RichTextBox1.Lines = RichTextBox1.Lines.
                Where(Function(x) Not String.IsNullOrEmpty(x)).
                OrderByDescending(Function(x) Decimal.Parse(x.Split(" "c)(0))).ToArray
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jul 2013
    Posts
    108

    Re: [vb.net] Sorting decimal in ascending order in richtextbox

    Quote Originally Posted by Niya View Post
    The blank lines cause the error. You have to filter those out:-
    Code:
            RichTextBox1.Lines = RichTextBox1.Lines.
                Where(Function(x) Not String.IsNullOrEmpty(x)).
                OrderByDescending(Function(x) Decimal.Parse(x.Split(" "c)(0))).ToArray

    Hey Niya, thanks it works! Sorry but in the output I don't have blanklines, I don't know why it formatted like this in my question .
    The code just works properly!
    Might I just ask you how to reverse this code ordering by ascending?

    Again, Thanks

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: [vb.net] Sorting decimal in ascending order in richtextbox

    Quote Originally Posted by matty95srk View Post
    Might I just ask you how to reverse this code ordering by ascending?
    Change this:-
    Code:
    OrderByDescending
    To this:-
    Code:
    OrderBy
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width