[RESOLVED] Adding Events To Custom Controls
I have a custom control that has a series of comboboxes. In my application, I programmatically add the control to several programmatically created tabs. When the first combobox value is changed, I would like to iterate through each of the controls and set their value to match. I know how to iterate through the tabs and find a particular combobox within each control, but I haven't been able to figure out how to assign an event to those comboboxes to trigger the search in the first place.
How does one assign an even to a subcontrol within a custom control?
Re: Adding Events To Custom Controls
Its very easy. Use AddHandler.
Re: Adding Events To Custom Controls
I've used AddHandler on a programmatically created standard control, but how would I do that with MyCustomControl.ComboBox1? Loop through the control at creation, find the Combobox and add it that way?
Re: Adding Events To Custom Controls
The custom control would have a public Controls property which would give you a collection of all the controls on its surface. Use that in combination with AddHandler.