I'm trying to stick to the above rule, but I'm running in a situation where I do need an advice.
It is the same code I posted before, however another question it.
I need to AddHandles during Runtime. Actually I do that from a module like:
MainForm is the Starting Form which holds some UserControls (usrGram)
b are of Type ClassSomething, (as of now) neither a part of MainForm nor the UserControl.
I need each UserControl to react the Event PingerPing of each b, therefore I use the above AddHandler in the code which initially creates b. This code is in a module.
Because it is in a module the Sub "Ping_zeichnen" of the UserControl has to be Public, and that's the point.
The only way around this would be to make two events, one from b, on which a sub in the module is run, which raises an event on which the UserControl is already reacting.
The only other way I see to avoid the Public Sub is to use AddHandler in situation when there is already the Handler added/ RemoveHandler when the handler is already removed. Is there something that tells you if a specific handler is set or removed?
It is the same code I posted before, however another question it.
I need to AddHandles during Runtime. Actually I do that from a module like:
vb Code:
For Each g As usrGram In MainForm.GramList AddHandler b.PingerPing, AddressOf g.Ping_zeichnen 'b as an ObjectType with a Event called PingerPing Next
b are of Type ClassSomething, (as of now) neither a part of MainForm nor the UserControl.
I need each UserControl to react the Event PingerPing of each b, therefore I use the above AddHandler in the code which initially creates b. This code is in a module.
Because it is in a module the Sub "Ping_zeichnen" of the UserControl has to be Public, and that's the point.
The only way around this would be to make two events, one from b, on which a sub in the module is run, which raises an event on which the UserControl is already reacting.
The only other way I see to avoid the Public Sub is to use AddHandler in situation when there is already the Handler added/ RemoveHandler when the handler is already removed. Is there something that tells you if a specific handler is set or removed?