[Mono-list] Ported code from VB6 to VB.NET problem

Paul Johnson paul at all-the-johnsons.co.uk
Thu Mar 21 15:57:28 UTC 2013


I've ported some of my old code from VB6 to VB.NET and have fixed just 
about all of the issues except for one.

In VB6, there are collection arrays (so you can have the likes of an 
array of buttons etc). To get around the lack of these in VB.NET, I'm 
using a List for them

For example

Dim WithEvents cmdButtons As New List(Of Button)

then in the Load event

cmdButtons.AddRange(New Button() {_cmdButton_0, _cmdButton_1})


This works fine. The problem is with the event handling. You obviously 
can't trigger a Click event (say) on a List.

Short of creating a tonne of the same methods to fire off the events for 
each cmdButton, is there some generic way that everything within that 
List fires off the event?

"Space," it says, "is big. Really big. You just won't believe how 
vastly, hugely, mindbogglingly big it is. I mean, you may think it's a 
long way down the road to the chemist's, but that's just peanuts to 
space, listen..."
Hitch Hikers Guide to the Galaxy, a truly remarkable book!

More information about the Mono-list mailing list