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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to populate a Combo Box from a cursor

Status
Not open for further replies.

Jomercat

Programmer
Sep 1, 2004
100
US
Hi,

I believe I placed this message in the wrong group.

Here it is again.

I am new to VFP and Ineed to poulate a combo box from a cursor; for example.

Select * from tablename into cursor temp.

I want the results of the temp cursor to populate the combo box.

Any help would be appreciated.

Jose.
 
Just set the RowSourceType property of the combobox to 2-Alias, then set the RowSource property to the name of your cursor.
Make sure you have the cursor available before the combobox gets instantiated though. In other words, the cursor has to be created programmatically prior to running the form, or in the form's Load event.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
DSummZZZ,

Thanks so much!!!!

It worked.

Jose.
 
Jose,

You can also set the RowSource property to the SQL statement itself (Select * from tablename into cursor temp) with the RowSourceType property to 3-SQL Statement.

Teresa
 

Just one other point to add to the good advice you've already been given: Set the combo box's ColumnCount property to the number of fields from the cursor that you want to display.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks all of you who replied!!!!

I appreciate your help.

MikeLewis- Will it work the same if I just use the RowSource like this?

.RowSource ='Cursor.field'

Thanks.

Jose.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top