Databound combobox

  • Thread starter Thread starter jan v
  • Start date Start date
J

jan v

Hi everyone.

I have a user control with 2 comboboxes these comboboxes are Databound to
the same datatable..
Wheb 1 add 2 of thos usercontrols (not the comboboxes but the usercontrol
itself) to one form and change the value in one combobox, then they all (4)
change there selected value. Does anyone know a way to prevent this from
happening?

Thank you in advance
 
Jan,

Since you are binding to the same data table, they are all using the
default views on the table, which means that they all have the same data
source. Because of this, when the position changes on one, they change on
all of them. My suggestion is to create a different instance of the
DataView class for each combobox, and bind to that.

Hope this helps.
 
jan v said:
Ah thanks, didn't thought of that, thats why a combobox has a property
sorting, because it has a dataview.

I'll try it


in message news:#[email protected]...
Jan,

Since you are binding to the same data table, they are all using the
default views on the table, which means that they all have the same data
source. Because of this, when the position changes on one, they change on
all of them. My suggestion is to create a different instance of the
DataView class for each combobox, and bind to that.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

jan v said:
Hi everyone.

I have a user control with 2 comboboxes these comboboxes are Databound to
the same datatable..
Wheb 1 add 2 of thos usercontrols (not the comboboxes but the usercontrol
itself) to one form and change the value in one combobox, then they
all
(4)
change there selected value. Does anyone know a way to prevent this from
happening?

Thank you in advance
 
Back
Top