Results 1 to 9 of 9

Thread: sort a listbox

  1. #1

    Thread Starter
    Registered User
    Join Date
    Feb 2004
    Posts
    62

    sort a listbox

    list1(1).sorted = true

    why doesnt that work? i get a cannot assign to read-only property error

  2. #2
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718
    Set it at design time from the properties on the right.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  3. #3

    Thread Starter
    Registered User
    Join Date
    Feb 2004
    Posts
    62
    cant do that using arrays.... unless i load the object without using the code to load the array object, but i dont know how many arrays i will need, so that wouldnt work.
    Last edited by Reki; Feb 22nd, 2004 at 02:34 AM.

  4. #4
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Dont think you can change the sort during runtime, and it's false by default.

  5. #5
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718
    Yes you can. Select the list box and set it in the properties window, i did it.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  6. #6

    Thread Starter
    Registered User
    Join Date
    Feb 2004
    Posts
    62
    Originally posted by Ideas Man
    Yes you can. Select the list box and set it in the properties window, i did it.

    you can do it with a normal listbox, but not with an array that you load with your code. you cannot select a listbox where it cannot be seen

  7. #7
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    He is creating them at runtime, how are you going to access the properties when it doesn't exist?

    Originally posted by Ideas Man
    Yes you can. Select the list box and set it in the properties window, i did it.

  8. #8
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718
    Dunno, I'd say you could when you create it, i don't actually know how to create controls in code.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  9. #9
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    We'll if all else fails, use a temp listbox, .visible = false, sorted = true.

    Then transfer items there to sort them (clear sorter first), move them back to the source (source cleared first) then clear the sorter (just to make sure its clear).

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