J
Jeff Molby
I'm trying to implement the following code.
I want the base class to compile a collection of ComboBox controls and
handle their SelectedIndexChanged() event. I can't figure out how though.
I get a compile error on line 10.
"'cbx' is not an event of 'BaseClass'"
The first paramenter of the AddHandler statement is supposed to an Event,
but I don't know how to get a reference to the SelectedIndexChanged event of
cbx.
Public Class BaseClass
Dim colLookups As Collection
Protected Sub AddLookup(ByRef cbx As System.Windows.Forms.ComboBox)
10 AddHandler cbx, AddressOf cbxLookup_SelectedIndexChanged
colLookups.Add(cbx)
End Sub
Protected Overridable Sub cbxLookup_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
End Sub
End Class
Public Class ChildClass
Inherits BaseClass
Public Sub CreateLookupControls()
'Creates any number of ComboBoxes (or none), changes various
settings, and sends each combo to MyBase.AddLookup()
End Sub
End Class
Any ideas??
Thanks!
I want the base class to compile a collection of ComboBox controls and
handle their SelectedIndexChanged() event. I can't figure out how though.
I get a compile error on line 10.
"'cbx' is not an event of 'BaseClass'"
The first paramenter of the AddHandler statement is supposed to an Event,
but I don't know how to get a reference to the SelectedIndexChanged event of
cbx.
Public Class BaseClass
Dim colLookups As Collection
Protected Sub AddLookup(ByRef cbx As System.Windows.Forms.ComboBox)
10 AddHandler cbx, AddressOf cbxLookup_SelectedIndexChanged
colLookups.Add(cbx)
End Sub
Protected Overridable Sub cbxLookup_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
End Sub
End Class
Public Class ChildClass
Inherits BaseClass
Public Sub CreateLookupControls()
'Creates any number of ComboBoxes (or none), changes various
settings, and sends each combo to MyBase.AddLookup()
End Sub
End Class
Any ideas??
Thanks!