I am building a new application in VS2005 and I am using form inheritance since it saves me a lot of development time (ok, kinda- sorta). In my base form, I have a ComboBox control and New, Save, Delete and Undo buttons. The combobox is bound to a dataset and the SelectedIndexChanged event is overridden in the inheritance form.
Base Form:
Public Overridable Sub cbSelectItem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSelectItem.SelectedIndexChanged
If Not bNewRow Then
Me.StaffBindingSource.Position = Me.cbSelectItem.SelectedIndex
End If
End Sub
Inheritance Form:
Public Overrides Sub cbSelectItem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSelectItem.SelectedIndexChanged
'Excute the base class method
If Not MyBase.cbSelectItem.SelectedIndex = -1 Then
MyBase.cbSelectItem_SelectedIndexChanged(Me, e)
Me.LoadBindStaffAffiliationTable()
End If
End Sub
Here is the ugly wrinkle: For some reason, the SelectedIndexChanged event is executed twice for any single click of the combo box AND this is true for any singleClick event of New, Save, Delete or Undo. It's as though the Base form is causing this problem but I cannot put my finger on it. Every control is fired twice.
Does anyone have a pointer as to where to look first in order to resolve this problem? I have to believe it's form inheritance causing my problem but I don't recall this problem with form inheritance in VS2003.