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

Combo List Sorting?

Status
Not open for further replies.

PogoWolf

Programmer
Joined
Mar 2, 2001
Messages
351
Location
US
Hey all,
I'm working in VFP 3.0, and haveing an issue with sorting
data.

I have a combo box on a form, and trying to sort the list.
I've tried setting the sort properite to 'true' but FoxPro will not let me. (always goes back to False) and I've tried
adding code (thisForm.Combo2.Sort = .T.) but that doesn't seem to work either...

does anyone have any ideas? =)
---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
Sort only works if the row source type is set to value or you are manually adding the rows. If you are binding to a cursor, array or sql statement they must be sorted in the order you want rather than using the sort property.
 
Well, that explains why it's not working.... =)
I think the data is bound via the cursor (I just created the combobox, clicked the 'builder' and made the connection that way)

Could you please, explain how I might be able to sort this?

Thank you!


---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
if you are using the foxpro tables the easiest way IMHO is to set the rowsourcetype to sql statement, and in the rowsource put a sql statement like the following

select code from mytable order by code into cursor curcodes

you need the into cursor part to prevent the select statement from opening a browse window (the default)

if you are using views I usually select the rowsourcetype of alias and then create a view the selects the fields I need in the correct order.

 
You most likely have the combo box rowsource property set to an array, table or other source.(rowsourcetype is related too). If this is the case, you can't set the sorted property.. Hope this was of help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top