J
Jim Witt
Ref: Win2000, .NET 1.1
I want to place series of buttons on a form, my own button class. Would
like to create descriptor array to describe buttons - each needs: text,
x and y position, and method invoked when button clicked.
I've been able to create descriptor with 'text, x, y' just fine (no
brainer). However, I designate button click method as follows:
this.button.Click += System.EventHandler(MyMethod);
public void MyMethod()
{
... code
}
This works fine.
Now, I don't know how to deal with is situation like following, which is
what I need to do:
string bMethod = "MyMethod";
this.button.Click += System.EventHandler(bMethod);
I understand the argument to 'System.EventHandler' cannot be string. But
I don't understand Delegates and Interfaces well enough to know how to
convert string to proper type.
Thanks,
Jim
I want to place series of buttons on a form, my own button class. Would
like to create descriptor array to describe buttons - each needs: text,
x and y position, and method invoked when button clicked.
I've been able to create descriptor with 'text, x, y' just fine (no
brainer). However, I designate button click method as follows:
this.button.Click += System.EventHandler(MyMethod);
public void MyMethod()
{
... code
}
This works fine.
Now, I don't know how to deal with is situation like following, which is
what I need to do:
string bMethod = "MyMethod";
this.button.Click += System.EventHandler(bMethod);
I understand the argument to 'System.EventHandler' cannot be string. But
I don't understand Delegates and Interfaces well enough to know how to
convert string to proper type.
Thanks,
Jim