Databound combobox

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
J

jan v

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top