How can you make a class register an event?

G

Guest

Here is what i am trying to accomplish.
I have a group of user defined controls and i have a form. the form has a
tab control and a menubar. the user defined controls will be add one to a tab
page.
what i want to do is create a class that will manage the tab control. it
will have methods that the menu can use to have the control added without
creating the control, that will be handled by the manager. in a sense i want
to have the form ignorant of the user defined controls and have them handled
only by the manager.
now comes my problem.
each of the user defined controls have a delegate/event to notify when the
user clicks the close button on the control. when i try to create the event
handler in the manager class it shows the the "+=" is not recognized.
any ideas how to work this? am i going about it the right way?
thanks for any help.
 
G

Guest

Yes it does. Each of the user defined controls have the same declarations:

public delegate void CloseBtnClickedDelegate();
public event CloseBtnClickedDelegate CloseBtnClicked;
 
M

Marc Gravell

Not sure, but it may be the unusual signature confusing the IDE. Since
you aren't returning any special data, can I suggest that you get rid
of your delegate and use the standard EventHandler instead?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top