Click to See Complete Forum and Search --> : AddressOf Button


Chrispy360
October 1st, 2009, 04:06 PM
Hi Guys,
I have made a class which creates a button depending on what data i send to the sub.
When i send the information, eg: Name, Text, etc, I give it a string which i want to be the addressOf the created button for example

Dim ButtonClickEventSub as string ' Similar variable is brought in

AddHandler ButtonObject , AddressOf ButtonClickEventSub 'This doesn't work but is sort of what i want.

Unfortunately the sub is also in the form so i think it needs to be reference some how like: Form1.ButtonClickEventSub


Thanks in advance
Chris

dglienna
October 1st, 2009, 06:58 PM
Bad design. A class shouldn't know about anything outside of itself. Move the sub to the class, and load a dummy value, maybe.