>Hi All,
>
>I'd like to add a listbox on my form similar to the ones you see that ask you to select a State.
>
>You can press a key, (ie; "P" for Pennsylvanaia) and the first state to match shows up, then you can fine tune by moving the arrow keys.
>
>I'm not selecting "States" but the idea would be the same.
>
>Does anyone know where a sample of this can be found or have any suggestions as to how to accomplish this.
>
>TIA
>
>Jim Harvey
>
jharvey@netrax.net (office)
>
jeh@gscyclone.com (home)
Hello Jim,
Depending of what you want to use as your .RowSource for the listbox you select the listbox.RowSourcetype. Just 2 examples.
If your "states" are in the table, you may set list1.RowSourceType = 6 - (fields). Set list1.rowsource to
mytable.state Make sure that list.IncrementalSearch property is set to .T. Assuming that the table is ordered by state you will get what you want
The same result you can achieve with RowSourceType = 3 - (SOL Statement) In this case you put in list1.RowSource
SELECT mytable.state FROM mytable ORDER BY mytable.state into cursor _cstate
You should put in your list1.Destroy()
IF USED("_cstate")
USE in _cstate
ENDIF
to make sure that the cursor will be closed.
HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison