Subject Re: [IBO] how to use the IB_Listbox
Author Helen Borrie (TeamIBO)
At 02:58 PM 15-01-02 +0100, you wrote:
>I am trying to use a IB_Listbox to display the result of a IB_Cursor. I use
>a IB_Datasource which is linked to the listbox and the cursor but I can't
>seem to get it to work. No error messages, correct connection to the
>database but no text in the listbox.
>How can I get this to work? Does anyone perhaps have a simple example?


That's not the way the ib-listbox works. It is a data-aware control that binds the currently selected value in the list to a column in the table or query that is using it. You have to load the Items of the listbox manually. The datasource should connect to the table or query that is using the listbox, and then you use the listbox's Datafield property to bind it to a column in that dataset.

Selection of a different value can only be done in edit mode.

By all means use a TIB_Cursor to load the list. You can even display one value in the listbox and another value (in the ItemValues property) to bind to the parent table. Let's say the cursor's SQL is

select FavFoodID, FavouriteFood from favourites order by FavouriteFood

In an event (perhaps FormCreate? or make it a procedure that you can call from FormCreate and elsewhere, in case you need to refresh) load the listbox from the cursor as follows:

with MyListbox, MyCursor do
if Items.Count > 0 then
while not EOF do

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at