Is there an alternative to a combobox for selecting -- VB2005?

G

Guest

Greetings,

I have to load 30,000 unique names into a combox. Filling a dataTable takes
only a few milliseconds. But populating the combobox and displaying the list
takes several seconds - way too long. A user selects a name from the
combobox and runs a query.

Originally, this combox was on a form in an MS Access ADP which was linked
directly to our sql server. The combobox populated withins millisecnods.
How can I achieve this kind of performance in my VB2005 app? what is the
bottle neck here?

Thanks,
Rich
 
S

Stephany Young

30,000 items in a ComboBox, is just ridiculous. It might be nice an
convienient for you from a coding point of view but users are simply
incapable of dealing with that amount of information at once.

As you have found, MS Access has a lot of smarts (some might say dumbs) that
deal with this sort of stuff in the background but those 'features' are
specific to MS Access.

Surely there is some aspect about the 'list' of unique names that would
allow you to subset the information, say those unique names starting with
'A' or 'a'. This would mean that you only need to load a subset of the list
at any given time.
 
J

jeff

rich,

I assume your users are aware that if they start typing the list will
automatically scroll - right! otherwise I bet your company has had to
replace quite a few mice over the past year (scroll wheel dieing)...

That being said ... here is a work around...

------------------------
- text box ...

- delay timer event ...

- popup window ...

= user control!
------------------------

- user starts entering the persons name...
- wait for a split second delay in the typing ... or after the first 3 chars
are recieved... something.
- popup a window ... just below the text box ... populate a grid control in
the window ... filtered list of the 30,000 people based on user entries ...
allow the user to select a value in the popup!

....

if the user wants to 'scroll the entire' list looking for Stewart Smith ...
give'em a hot-key to popup the window ... retrieve the first 2000 records
.... show the popup ... in the background continue populating the list!

But I agree with Stephany, your design is flawed if you are presenting the
user with a combo box of 30,000+ options! I once had a college manually
scrolling our clients list (2,000 records) to find Simpson Construction Ltd
.... she had been doing this for 3 years ... i work over, typed Simp ... the
selection was in the box ... u should have seen her expression! So,
hopefully, you do not have a user that thinks they need to scroll the entire
list to find employee ... Zoo Zoo ...


Jeff
 
J

jeff

if you do this ... be careful not to create a lot of round trips to the
server...or a delay between the user entering a letter...

person enters SIM ...
delay after S to retrieve data and populate the combo box...
delay after I to retrieve data and populate the combo box... do not need to
retrieve ...S will have already populated cb with necessary records...
delay after M to retrieve data and populate the combo box ... do not need
this retrieve ... S will have already populated cb with necessary records...

person, clicks on the S and deletes it ... so ... not they have IM
delay ... combo box needs to retrieve and populate list...
user deletes M ... delay ... combo box needs to retrieve and populate
list...

you see where this is going ... you will be causing delay for the user and
you will have alot of round trips to the server.

plus, you will have to capture if the first letter the user entered has
changed ... causing your list to 'refilter'

The round trips are easy ... retrieve all the data for the list and cache it
in-memory...

The time will be 'purging the combo list' and 'refilling it'... this will
cause a delay ... the user will be typing and will not see anything...until
your have populated, purged, populated, purged, populated the combo box
value list.

I would recommend a timer event ... wait for a delay ... popup window ...
that 'looks' like a combo box.


Jeff.
 
G

Guest

Check into using a DataView on the Dataset. You can set the RowFilter
property to something like "CompName LIKE '" & ComboBox.Text.ToString & "*'"
Since you said that the dataset is populated very quickly this will give you
a subset of the DataTable without having to go back to the server. It will
only show you a portion of the DataTable. If you put this in the TextChanged
event the DataView will be refreshed with each letter even if the user
deletes a letter or something like that.
 

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

Top