The Handles attribute replicates Visual Basic's declarative event handlers syntax. The same Visual Basic restrictions apply. They are documented at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconWithEventsHandlesClause.asp
- It cannot be used in structs.
- It cannot be used in with shared events.
- The field must be PRIVATE, (Boo fields are PROTECTED by default).
- Since the field is private, it cannot be used by derived classes.
- Note that there is no [WithEvents]. It's not needed.
- Dynamically attaching/detaching handlers in addition to HandlesAttribute on an object is not recommended.
If you need dynamic handles functionality, register you handlers manually.
- I suggest you google <Visual Basic WithEvents Handles> for more information.
private bar as Bar = Bar() <-- works
private zap as Zap
zap = Zap() <--- works
bar = Bar() <--- works
[Handles(bar.Click, zap.Click, ...)]
def SomethingClicked(sender, e as ClickEventArgs):
A nice screenshot can be found at http://img23.imagevenue.com/img.php?loc=loc77&image=d9c_CleanBoo.JPG
Put exception messages in strings.txt for globalization purposes.
Find a better way to display errors.
Create everything after type check.