How can I sort a DBLookuplistbox??? 
Author Message
 How can I sort a DBLookuplistbox???

I finally got my Dbase working and added a DBLookuplistbox to it which works
great, but I have a problem.
In for example the Explorer you can click on name or size or whatever and
then the explorer will sort the directory by name/size/whatever.
I want to do the same with my DBLookuplist, by how can I do this ?!??!

Greetz, Bart ten Brinke



Wed, 18 Jun 1902 08:00:00 GMT  
 How can I sort a DBLookuplistbox???

Quote:
> In for example the Explorer you can click on name or size or whatever and
> then the explorer will sort the directory by name/size/whatever.
> I want to do the same with my DBLookuplist, by how can I do this ?!??!

Any data-aware control that displays a list of records from a dataset can
only display those records in the order they are in the dataset. So to
change the order, you need to change the sort order of the dataset.

If the DBLookupList.ListSource is a TDataSource linked to a TTable, the
order will be determined by the active index of the TTable. To change the
list order, you have to change the TTable.IndexName, or create and activate
a new table index.

If the DBLookupList.ListSource is a TDataSource linked to a TQuery, the
order will be determined by the an "order by..." line in the SQL property.
To change the list order, you have to change the SQL and close/open the
query.

--
Stephen Brown



Wed, 18 Jun 1902 08:00:00 GMT  
 How can I sort a DBLookuplistbox???
Eeeh, have you got an example of that?
Because I get the idea, but I still don't know how to program it :(
And how can I use the top-'buttons'in de DBlookuplistbox like the explorer
does??

Greetings, Bart ten Brinke

Quote:
>Any data-aware control that displays a list of records from a dataset can
>only display those records in the order they are in the dataset. So to
>change the order, you need to change the sort order of the dataset.

>If the DBLookupList.ListSource is a TDataSource linked to a TTable, the
>order will be determined by the active index of the TTable. To change the
>list order, you have to change the TTable.IndexName, or create and activate
>a new table index.

>If the DBLookupList.ListSource is a TDataSource linked to a TQuery, the
>order will be determined by the an "order by..." line in the SQL property.
>To change the list order, you have to change the SQL and close/open the
>query.



Wed, 18 Jun 1902 08:00:00 GMT  
 How can I sort a DBLookuplistbox???

Quote:
> Eeeh, have you got an example of that?
> Because I get the idea, but I still don't know how to program it :(
> And how can I use the top-'buttons'in de DBlookuplistbox like the explorer
> does??

Maybe I'm missing something here, but as far as I'm aware DBLookupListBox
doesn't have an 'top buttons', so I can't help you with that.

How you change the sort order of the dataset depends on whether you are
using a TTable or TQuery. For TTable, look at the IndexName and IndexDefs
properties and the AddIndex method. For TQuery, add an "order by" clause to
the SQL
property. SQL is documented separately in a help file called Localsql.hlp.

--
Stephen Brown



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. It's not bad canned meat...

2. Shell sort vs. Comb sort (was: sorting arrays)

3. Begin or End of table error using DBlookuplistbox component

4. OnDblClick in DBLookupListBox

5. Focus in DBLookupListBox?

6. Items count for a DBlookuplistbox?

7. DBLookupListBox weird behavior

8. DBLookUpListBox bug???

9. Changing display width in DBLookupListBox

10. DBLookupListBox

11. Q: MultiSelect in DBLookupListBox?

12. How to fill DBLookuplistbox with the result of a query

 

 
Powered by phpBB® Forum Software