dcsimg
Results 1 to 3 of 3
  1. #1

    Thread Starter
    New Member Patikol's Avatar
    Join Date
    Apr 2015
    Posts
    5

    Question Invert Listbox Items

    Hello people,

    I have a listbox and I want to invert the items in it (reverse them, the first goes last and the last goes first).

    Any short ways to do it?

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,329

    Re: Invert Listbox Items

    Voila:
    Code:
    Dim reversed As IEnumerable(Of String) = ListBox1.Items.Cast(Of String).Reverse
    ListBox1.DataSource = reversed.ToArray

  3. #3

    Thread Starter
    New Member Patikol's Avatar
    Join Date
    Apr 2015
    Posts
    5

    Re: Invert Listbox Items

    Quote Originally Posted by dday9 View Post
    Voila:
    Code:
    Dim reversed As IEnumerable(Of String) = ListBox1.Items.Cast(Of String).Reverse
    ListBox1.DataSource = reversed.ToArray
    Awesome, thanks!

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
  •  



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.