Results 1 to 9 of 9

Thread: Limit of ListBox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    ListBox has a limit of 64 KB.

    What can I do if I need to store in my ListBox a list that has more than 64 KB?

    Thanks!

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Actually according to Help the maximum number of items is 32K.

    Could you use multiple listboxes or perhaps a grid with one or more columns?

    ------------------
    Marty

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    I didn't use multiple listBox. The list must show in a single ListBox control.

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    Perhaps you could reduce the Character Length of the Items you're Listing to enable you to store more Items, ie. use Abbreviations

    Then store the actual List in an Array and use the ListIndex property of the List to reference the Array to Display the Full Information when an Item is selected.

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Aaron, unless I misunderstand what's in the help file, or the help file is wrong (which wouldn't be the first time), it's the number of items that is limited to 32K so abbreviations won't help. Here is what Help has to say:
    Limitations for Particular Controls
    The following table lists property limitations that apply to particular controls in Visual Basic.

    Property Applies to Limitation
    List and ListCount List box and combo box controls Maximum number of items is 32K; the limit on the size of each item is 1K (1024 bytes).


    Tonatiuh, If you are limited to one listbox, one thing you could do is to only load the first 32K initially into the listbox, keep track of where the user is in the list, and if he/she is near the end of the initial list, delete, say, the first 1000 entries and add the 1000 that follow the initial 32K at the bottom, etc.

    ------------------
    Marty

  6. #6
    Lively Member
    Join Date
    May 1999
    Location
    Vancouver, BC, Canada
    Posts
    84

    Post

    ListBoxes are used to display data and for user selection. I can't imagine a user willing to work with 64,000+ items in a ListBox!

    Where do the items come from? If they're not in a "easily usable" container, put them in an array or a recordset.

    Allow the user to type the 1st few characters and display only the items that start with those characters.
    -or-
    Display 26 commandbuttons (in a control array) whose captions are the letters of the alphabet. The user clicks "B" and the prg displays all items starting with "B".

  7. #7
    Guest

    Post

    Doesn't anyone make custom controls for this kind of case? It seems that would be a worthy project.

  8. #8
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    There are a lot of third party controls that has a limit in a Long size instead of Integer like native ListBox has, but they're all pricey. Anyway, take a look at the FarPoint's ListPro control. It allows you to add a Long number of items (which is more then 2 billion)

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    Can't you just use a ListView instead. It uses a Long instead of an Integer for the item index.

    ------------------
    Joacim Andersson
    joacim@programmer.net
    joacim@yellowblazer.com
    www.YellowBlazer.com



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