Re: Populating a listbox from a database table

Posted by webmaster Guido on October 24, 2002

In Reply to: Populating a listbox from a database table posted by Lesley Gousmett + P12256 on October 24, 2002:

: IS it possible to populate a listbox from a database table and if so, then can someone please tell me how to go about it. I have a listbox control, which I have manually added the entries to. The highlighted entry in the list box can be added to a gridbox, which also appends the record to the table. I now wish to have the listbox so that is it is used in the same manner, but populated from another table.
------------

You could use a TDBLookupListBox. Delphi's help says:
"TDBLookupListBox provides a list of lookup items for filling in fields that require data from another dataset."

This is a lot easier than writing code to fill a normal ListBox by traversing all the records of the "lookup" table, extracting field values, adding them to the Listbox, and replacing the first table's field by the value selected from the listbox... :)

Just give me some time, I'll test out some code and I'll post an example.


Related Articles and Replies:

Related articles

Turbo Delphi Explorer
Database programming with the latest FREE Delphi version. Download and install!
     


[ DelphiLand Discussion Forum ]