I have 2 combobox controls that are loaded via a DataTable. Both CB's use the same DataTable to load them. However, prior to loading I assign the DataTable to a newly created DataTable. I'm loading these CB's with the same values, however, each one could contain a different selected value.
My problem is that when I select a value from one, the other CB automatically reflects the same value, why is that and how can that be resolved...other than creating a new routine as a separate load.
Here is my code:
Public Sub LoadCombo_Direction()
Dim ds As New DataSet
cmbDirection1.DataSource = Nothing
cmbDirection2.DataSource = Nothing
If EH.DataSet.Tables(0).Rows.Count > 0 Then
ds = EH.DataSet
RemoveHandler cmbDirection1.SelectedIndexChanged, AddressOf cmbDirection1_SelectedIndexChanged
cmbDirection1.DisplayMember = EH.DataSet.Tables(0).Columns(1).ColumnName
cmbDirection1.ValueMember = EH.DataSet.Tables(0).Columns(0).ColumnName
cmbDirection1.DataSource = EH.DataSet.Tables(0)
cmbDirection1.SelectedIndex = -1
cmbDirection2.DisplayMember = ds.Tables(0).Columns(1).ColumnName
cmbDirection2.ValueMember = ds.Tables(0).Columns(0).ColumnName
cmbDirection2.DataSource = ds.Tables(0)
cmbDirection2.SelectedIndex = -1
AddHandler cmbDirection1.SelectedIndexChanged, AddressOf cmbDirection1_SelectedIndexChanged
Catch ex As Exception
EH.ErrorMessage = "LoadCombo_Direction() - " & ex.Message & "~E"
EH.ProcessMessages(Me, sbr, EH.ErrorMessage)