Comboboxes loading datasource too many times

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I have a form with tabpages on them. On one tabpage I have three
comboboxes all of which derive their datasource from the same table:-


TimePeriodID TimePeriod
1. Day(s)
2. Week(s)
3. Month(s)
4. Year(s)


When binding the fields for this form, I fill three sqldataadapters
with the data from this table.

I then set the datasource, valuemember, displaymember and databindings
properties of each combobox. Each combobox is of course bound to
different fields on the same tabpage.

What I find on running the form however, is that each combobox has
performed a "Union Query" on the datasource. That is the values of
the datasource have been loaded three times. So in the example above
I have TimePeriodID 1-4, followed by TimePeriodID 1-4, followed by
TimePeriodID 1-4.

Can anyone help me out of this little conundrum?



Richard
 
You are filling the same datatable three times.

Create separate datatables...one for each combobox.

Then set the datasource for each combobox to the separate datatable.
 
Aah! Thank you.



You are filling the same datatable three times.

Create separate datatables...one for each combobox.

Then set the datasource for each combobox to the separate datatable.
 
Back
Top