coppe
asked on
Index rows in a combobox
It is possible to add more than 32768 rows to a combobox, but how can I index the rows that are over 32768?
Why in Gawd's name would you want to put 32,000 entries into a combobox? Thankfully the answer is NO you cannot add more. Tell us a little bit more about what you are trying to do.. before your vertical scroll bar thumb becomes no larger than a pinhead.. <smile>.
no doubt, why so many in a combobox? who is going to pull that baby down and scan for an entry? once we get a better idea of what youre trying to do we can figure out a more practical workaround.
ASKER
When the user make a input in a textbox a selection is made in the combobox and the first row which is equal to the input is shown in the combobox. The user can then click on the combobox and select among the rows who starts with the input. The design of the form doesn't allow a bigger control than the combobox.
coppe.. we understand that.. but why on earth do you want to put 32kb entries into the combo? That's kinda like storing Webster's entire Dictionary into the combobox so that the user can find a single word. It can be done.. but it just isn't practical.. scrolling through 32,000+ entries just ain't fun. As a programmer, you want to make your user interface friendly and intuitive.. not a thumb scrolling drudge. So if you would, please be more specific about what you are putting into your Textbox and then what you want to see in your Combobox.. and lets see if we can tweak this into something where the 32,000+ entries is no where near a limitation to your application.. <smile>.
also with 32K entries, even with autocompletion i would imagine a good amount of scrolling will be needed to find the item they are looking for, unless they happen to know the entire string they are looking for practically.
Why don't you have your users type into a textbox a few characters and then click a button next to the textbox that says find:
Or, an alternative, they type into the combo box as before, except that the combo starts out empty. Then, when they click the down arrow, the Drop_Down event fires, then you'd do the stuff below:
You then "select * from yourtable where description like '" & txtInput.text & "%'". You may get several results back, in which case you could populate the listbox with that.
Or, an alternative, they type into the combo box as before, except that the combo starts out empty. Then, when they click the down arrow, the Drop_Down event fires, then you'd do the stuff below:
You then "select * from yourtable where description like '" & txtInput.text & "%'". You may get several results back, in which case you could populate the listbox with that.
ASKER
The 32k are article numbers for a wholesale dealer. This amount of article numbers are nohing unusual for that kind of customer. After every new sign of the article number the user put in the textbox a new selection is made in the combobox which decrease the scrolling. Of course you don't scroll through 32k, but yes it is true that you must know almost the whole string to avoid to much scrolling.
Maybe it is better to start with an empty combobox and populate it only with the article numbers who starts with the input from the textbox.
I don't avoid the scrolling problem with this solution, but I don't think there is anything to do about that.
I think the time to fill the combobox is to high, but I will give it a try.
Maybe it is better to start with an empty combobox and populate it only with the article numbers who starts with the input from the textbox.
I don't avoid the scrolling problem with this solution, but I don't think there is anything to do about that.
I think the time to fill the combobox is to high, but I will give it a try.
having these numbers stored in a database you could display them in a grid for example, performing a query with the 'LIKE' operator depending on what the user has typed in of the article number
Adding to Azra's comment:
And as the grid is multicolumn.. complete with a scroll bar.. you could easily present more article numbers on each given screen. To make thingz even nicer, you can then click on the desired article number (in any column)and present the appropriate screen from there. Oh.. and yes.. Azra's suggestion to do LIKE positioning will work very efectively there as well.. as the cursor and grid can be positioned as the user types into the textbox.
To be honest, you really should consider setting up text searchs rather than article number selections. Keywords are much more user friendly than numbers ever could be. Additionally with keywords, users are accustomed to waiting for a bit of a response, something they will not be as patient with when searching on an abstract number.
And as the grid is multicolumn.. complete with a scroll bar.. you could easily present more article numbers on each given screen. To make thingz even nicer, you can then click on the desired article number (in any column)and present the appropriate screen from there. Oh.. and yes.. Azra's suggestion to do LIKE positioning will work very efectively there as well.. as the cursor and grid can be positioned as the user types into the textbox.
To be honest, you really should consider setting up text searchs rather than article number selections. Keywords are much more user friendly than numbers ever could be. Additionally with keywords, users are accustomed to waiting for a bit of a response, something they will not be as patient with when searching on an abstract number.
I have another option. This would provide the user 0% scrolling.
You can add the 32k entries in to the combo box while the form is loading itself. Then while the user types in the textbox, you can match the text in the text box with that of the combo box using APIs and the matching item in the combo box will be highlighted. Then, the user can click the highlighted item for further entries. If you are convinced with this, I can give you the source code for the above logic.
Expecting your consent!
Regs
Selva
You can add the 32k entries in to the combo box while the form is loading itself. Then while the user types in the textbox, you can match the text in the text box with that of the combo box using APIs and the matching item in the combo box will be highlighted. Then, the user can click the highlighted item for further entries. If you are convinced with this, I can give you the source code for the above logic.
Expecting your consent!
Regs
Selva
ASKER
The suggestion to the start with an empty combobox and populate it only with the article numbers who starts with the input from the textbox is a little bit too slow.
The grid suggestion is good but as I wrote before the layout is not allowing more than a textbox and a combobox.
I maybe misunderstand you Selva, but how do you avoid scrolling without typing almost the whole string?
I already add the entries when the form is loading.
The grid suggestion is good but as I wrote before the layout is not allowing more than a textbox and a combobox.
I maybe misunderstand you Selva, but how do you avoid scrolling without typing almost the whole string?
I already add the entries when the form is loading.
If you try to populate the list as you type, this will definately be too slow, but how about the idea of having the user type some characters and then click a Find button, to fill the list with all matches. That way, if they want to work on the A's they type in an A and then Find, and the list is full of entries that Start with A, when they're ready for the B's they type B and then Find, and the list has B's in it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi mdougan,
I think you have misunderstood my comments. I didn't mean to 'populate' the combo box while the user types in the text box, the typed text in the text box would just be 'matched' with that of the combo box. The items would be filled in the combo box while the form is loaded itself.
If you are still not clear with this logic, then I'll put my code here. you can work it out.
Coppe, you need not scroll at all. The API will do the trick. As you have said, fill the combo box while the form is loaded. After that, all you have to do is type the text in the text box and nothing else. When you type, you could see the exact match in the combo box. Hope you understand now. Actually, its not as difficult as you think.
Regs
Selva
I think you have misunderstood my comments. I didn't mean to 'populate' the combo box while the user types in the text box, the typed text in the text box would just be 'matched' with that of the combo box. The items would be filled in the combo box while the form is loaded itself.
If you are still not clear with this logic, then I'll put my code here. you can work it out.
Coppe, you need not scroll at all. The API will do the trick. As you have said, fill the combo box while the form is loaded. After that, all you have to do is type the text in the text box and nothing else. When you type, you could see the exact match in the combo box. Hope you understand now. Actually, its not as difficult as you think.
Regs
Selva
No, I understood correctly, but the problem here is that you don't want to try to load anywhere near 32.000 items into a combo box -- either at form load or otherwise.
So, the question is, how can you populate the listbox with (much) less than 32,000 items, and still give the user the ability to search through all of the items in the database.
The way that I've done this is to either have a textbox(s) on the form that the user types stuff into, and then clicks search, and you go back and retrieve all records that match the criteria, or if you give them a list or grid to scroll through, then as the user scrolls down the list, when they get near the bottom of the list, then you go out and get the next batch of records.
Both of these techniques work pretty well in the user interface.
So, the question is, how can you populate the listbox with (much) less than 32,000 items, and still give the user the ability to search through all of the items in the database.
The way that I've done this is to either have a textbox(s) on the form that the user types stuff into, and then clicks search, and you go back and retrieve all records that match the criteria, or if you give them a list or grid to scroll through, then as the user scrolls down the list, when they get near the bottom of the list, then you go out and get the next batch of records.
Both of these techniques work pretty well in the user interface.
ASKER
Comment accepted as answer