"pagates" <pa*****@discussions.microsoft.com> schrieb:
In C#, one function can handle events from multiple, as long as it has the
same delagate signature. For example, there might be a single event that
handles all the Checkbox.CheckChanged events.
Is this possible in VB.Net, or do all controls need to have a separate
event
that calls this single sub?
It's possible in VB.NET. There are two different ways. If declaration of
the variable holding the reference to the control contains the 'WithEvents'
keyword, simply add the control to the 'Handles' list of the event handler:
\\\
Private Sub Buttons_Click(...) Handles Button1.Click, Button2.Click
...
End Sub
///
Alternatively you can dynamically add the handler at runtime using the
'AddHandler' statement.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>