I am making a program which dynamically adds objects, such as a button or a checkbox to a form.
For each instance, a handler is added so a certain function is called for the Click event of each object.
Now, when that handler is called, how can I manipulate the object that fired off the Click event? The Sender object is useless here as I cannot change the location, text, parent, nothing at all.
Since the objects are being created dynamically, their instance name is unfortunately always going to be the same, therefore I cannot simply do things like button1.Text = "Button 1".
I really do not want to create a new subroutine for every type since the actions that would be performed are the same...so how can I manipulate these objects?
There are, at last count, 27 different object types which are being manipulated, and which I want to be manipulated by a single sub.
Thanks for the help!