Problem using combobox with tab control

Bilalq

Member
Joined
Jul 21, 2004
Messages
24
Programming Experience
3-5
Hello,
I am using a tab control with two tabs (Tab1, Tab2) and a combobox (Combobox1, Combobox2) on each tab. Both of the comboboxes are populated with identical values from the DB.
On Tab1 if I select somthing from the combobox1, it should also be selected from the combobox2 on Tab2 and it works fine. On Tab2, I want to be able to select something on combobox2 and not have the combobox1 be changed and that works fine too. The problem is when I select somthing from combobox2 on Tab2 and click the Tab1, it fires the selectedindexchanged event again on combobox1 on Tab1 and will change the value on combobox2 on Tab2 to what is in combobox1. I am not sure whay that is happening. Can anyone help? Thanks in advance.
 
Thanks for the response.
No, I am not doing anything with TabControl's TabIndex event.
Here is the code that gets fired when I click on tab2.

VB.NET:
Private Sub cboCarrier_ID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCarrier_ID.SelectedIndexChanged

		NewAccount.CarrierID = cboCarrier_ID.SelectedValue.ToString
		NewShipTo.ShipToCarrier = cboCarrier_ID.SelectedValue.ToString
		cboVA_Carrier_ID.SelectedValue = cboCarrier_ID.SelectedValue

End Sub

The SelectedIndexChanged event fills up couple of class variables and the second combobox on tab 2. It does just that, it's just when change my combobox2 on tab 2 and click the tab1 again the this event is fired again.
And it should not do that.
Thanks,
 
Back
Top