troubleshooting Question

Multiple combo boxes bound the the same dataset

Avatar of luisdavid
luisdavid asked on
Visual Basic.NET
3 Comments1 Solution307 ViewsLast Modified:
Ok, i have this problem.

Products Table:
.... other fields
Catego1 (int)
Catego2 (int)
Catego3 (int)
Catego4 (int)
.......

Catagories Table:
ID (int)
Name (Char 30)

Now, i have 4 combo boxes, bounded to the Categories:

cb1.BindingContext = New BindingContext
cb1.DataSource = MyDataset.Categories
cb1.DisplayMember = "VALUE"
cb1.ValueMember = "ID"
cb1.DataBindings.Add("SelectedValue", MyDataset, "PRODUCTS.CATEGO1")

cb2.BindingContext = New BindingContext
..... all combo boxes alike except for the Databinding to the corresponding field

Now, the problem, the BindingContext seems to be the key to the problem/solution
without assigning the new BindingContext, the combo boxes behaves as if all were linked to the same field,
if you change one, the other three will change to the same value. They are correctly posted to the products dataset,
the problem is you can only choose one category.

Now, if we do assign the New BindingContext so each combobox will have a diferent currencymanger, then
all the combo boxes behaves separately of the others, but the values are not readed or posted from/to the Products dataset.

Any advise?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros