Data Binding using list box's & Data Tables

jch001

Newcomer
Joined
Apr 7, 2006
Messages
18
Location
Near London UK
Hi,

I have two list box’s both of which are bound to two separate data tables in the same Data Set. i.e. lbA.datasource = ds1.Table1; lbB.datasource = ds1.Table2. I have set up a relationship between the two tables.

I expected to be able to select a value from list box A and List Box B would filter accordingly. It doesn't....

If I replace List Box B with a Data Grid B (same settings as List Box B) and add this line of code.

dgB.SetDataBinding(Me.ds1, "Table1.Relationship")

The data grid filters accordingly.

Does anyone know if you can do something similar with List Box's?
 
Why would you expect the listbox to filter?

One way would be to check onselectedIndexChanged for 1st listbox and manually populate the second.
 
Diesel said:
Why would you expect the listbox to filter?

I'm not really sure I guess I just did. As the listbox was bound to the datatable, I assumed that if the data in related datatable changed then it would filter the listbox dependant on the relationship I specified. If I reload the data in the datables then the listbox does update. It just doesn't seem to work for relationships.

Diesel said:
One way would be to check onselectedIndexChanged for 1st listbox and manually populate the second.

I have gone down a similar route. I’m manually populating the listboxs I have, and using a datagrid (the relationship filter does work here, saves another call to a stored procedure).

Thanks for your advice.
 
Back
Top