Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox Alternative For Large Amount of Items

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
0
36
US
I'm looking for alternatives to comboxes for lookups when there are a large amount of items (2000?). Maybe a textbox with a grid that could be refreshed as they type using a filtered view as the gird datasource. Don't display any records unitl N characters are typed. Let the user select from the grid at anytime. Can I make a class containing the textbox and the grid so I can drop it on any form? Any other suggestions as to how others have handled this type of problem are welcome.

Auguy
Sylvania/Toledo Ohio
 
If you want to go the textbox/grid route, I suggest trying a DataView with all of the data as the grid's DataSource. Set the DataView's RowFilter property to something that will return 0 rows. (Just in case you haven't worked with it before, the DataView's RowFilter property is set up like a Where clause in a SQL statement. For example: DataView1.RowFilter = "Field1 LIKE 'ABC*'", or DataView1.RowFilter = "Field2 = 123")

In the TextBox's TextChanged event, you could set the RowFilter property, so the data in the grid will change as text is entered.

Yes, you could make a User Control that has the necessary controls, and just drop that onto a form.

In my opinion, the optimal solution is to examine your logic to find a way to populate the combobox with fewer - far fewer - than 2000 items.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
What are the 2000 items you display?
Can you group them somehow?

Have fun.

---- Andy
 
Thanks for the info. I think I want to build my control with the textbox and grid in a panel and have the panel initially collapsed to the size of the textbox until they start typing and then expand the panel to show the grid. Then collapse the panel after they have chosen an item, canceled the search, or clicked somewhere else on th form.


Auguy
Sylvania/Toledo Ohio
 
Yes, I possibly could group them and narrow their search that way for some of the areas I want to use this type of feature, but it would probably slow the users down quite a bit. One of the area where I want to apply this is for customer lookup where they would type the first few characters of the name, but there might be several customers with similar names.

Auguy
Sylvania/Toledo Ohio
 
So your list is of Names?
One way: give them a list (links?) from A to Z, if they click on a letter, give them a combo with all names that start with this letter.
[tt]
A B C ... Z

Banable
Boyster
Brown
...
[/tt]

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top