All comboboxes automatically changing when user changes only one ???

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi,

I have a strange question... I have a series of combo boxes being
populated by the same dataset, and I've noticed if one is changed then
all change as well. I'm using Visual Basic 2005 and writing a Winform
app, and below is how I'm binding the dataset to the combobox object:

cbTotalCurrency.DataSource = CurrencyDataset.Tables(0)
cbTotalCurrency.DisplayMember = "CurrencyName"
cbTotalCurrency.ValueMember = "CurrencyID"

I have about 5 comboboxes using this same dataset and if I change any
of the dropdowns in the application when running, all 5 change to
whichever one I selected.

Other than creating 5 different datasets, is there anyway around
this? I want the user to be able to select a different item in each
combobox.

Thanks --

Alex
 
Alex,

One way to make the comboboxes independent of each other is to assign each
combobox a new binding context. For example:

cbTotalCurrency.BindingContext = New BindingContext
cbTotalCurrency.DataSource = CurrencyDataset.Tables(0)
cbTotalCurrency.DisplayMember = "CurrencyName"
cbTotalCurrency.ValueMember = "CurrencyID"

Do that for each of the comboboxes and then they should be independent.

Kerry Moorman
 
Back
Top