No, you get compiler error "with events variable does not raise
events."
It is possible to create a custom collection that listens to and
rebroadcasts events from any contained object, but that's not built
in.
Sam
On Tue, 8 Mar 2005 18:39:04 -0000, "Rob Nicholson"
<(E-Mail Removed)> wrote:
>A thought - has VB.NET been extended to be able to handle arrays or
>collections with events? A problem with VB6 was that you could only declare:
>
>Private WithEvents MyControl As MyControl
>
>Private Sub MyControl_Click()
>End Sub
>
>which could track one control on the form. If you happened to have code that
>add N controls at runtime, you had to create a wrapper class to capture the
>event, i.e. one object per control with the class containing the WithEvent
>declaration. I'd expect something like:
>
>Private WithEvents MyControls() As MyControl
>
>Private Sub MyControls_Click(Index As Integer)
>End Sub
>
>Hmm, I'm guessing not as it's not ringing any bells.
>
>Cheers, Rob.
>
B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
|