Updating drop-down listbox

Started by oradba4u, September 10, 2020, 11:06:20 PM

Previous topic - Next topic

oradba4u

All:
Can some one show me (with an example if possible) how to create a drop-down list box that "narrows in" on what you want as you type?

For example... I have a list of countries that should originally show every country in the drop-down list box, but then as I type the country name that I'm looking for narrows the list.

Thanks in advance

JTaylor

Not in a spot I can provide an example at the moment and of course there are numerous ways to tackle this but...

If you set it to List only and you want to match from the front it will automatically jump to the letter you type.


If that doesn't do what you want......................................................


Partly depends on your data source but I will assume a delimited list.

I will assume you know how to populate a dropdown list in a dialog.

Make a copy of your original list so you don't lose it and use a For Loop to step through your list.   Depending on whether you want matching from the front or anywhere in the value you could use StrSub() or StrIndexNC(), respectively.

If they don't match the filter use ItemRemove on the list.   Once you are done update the dropdown list with the filtered one.   This approach can be a bit slow and there are ways to make it more efficient but for 50 items it should work okay.

Jim

oradba4u