DotNet Academy of Rajesh Rolen

Solutions by Rajesh Rolen

Multiple Combobox with same datasource

One day Mr. Jodha asked me for solution for his prolem.
Problem:
-he used select query and got all data in datatable.
-then he made that datatable as datasource for two combobox which will show different
fields of that table
-but the proble is that when he select value from one combobox then the value of same record in second
combobox get selected.

and that is main problem.
Solution:Their exist very simple solution for this kind of problem
make a new bindingcontext for every combobox
combobox1.BindingContext = New BindingContext()
combobox2.BindingContext = New BindingContext()

When they are created, they inherit from the control that is hosting
them. Since you didn't specify it, it are all using the context of the
control/form that they are hosted in, and that's why when you change one
combo box, they all change.

0 comments:

Post a Comment

About this blog

My Blog List

Advertise On This Site

Site Info

Advertise on this Site

To advertise on this site please mail on RajeshRolen@gmail.com

Information Source

About

Pages

Dot Net Academy

Advertis in This Area of Site

Powered by Blogger.

Followers

Blog Archive

Search This Blog