ListBox.AddItem error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

when I fill up my ListBox (value list) with

ctrlListBox.AddItem Item:=strItem

the 193rd item genrates a runtime error 2176.

I would be surpised if only 192 items were allowed.

Is that a bug or a feature ?
 
Hi Henry,

As far as I can remember there is a limit on the number of items in a
listbox, but it's certainly much greater than 192. More likely you're
hitting a limit on the length of the ValueList string. If so, you'll need
either to use shorter or fewer items, or else put them in a table and use a
query for the listbox's RowSource.
 
I believe the maximum is 2048 characters for either a list box or combo box
value list.
 
Klatuu said:
I believe the maximum is 2048 characters for either a list box or combo box
value list.

This is not correct! The size you can add to a combobox or listbox
through VB is limited to 1024 chars.

You can use an API call to add items, this is described here:
http://dotnet.mvps.org/vb/code/controls/

Sincerely
Benjamin Herbert
 
I don't know what version of Access you are talking about. My information
comes from Access 2002 Desktop Developer's Handbook by Paul Litwin, Ken Getz,
and Mike GunderloyChapter 7 page 336:
"Enter a list of values, separated by semicolons, one row at a time (up to
2,048 characters)."
 
You're wrong Benjamin. Access List and Combo controls are not the same as
their VB counterparts.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top