PC Review


Reply
Thread Tools Rate Thread

How can you make a class register an event?

 
 
=?Utf-8?B?U2hhd24=?=
Guest
Posts: n/a
 
      30th Dec 2006
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.
 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      30th Dec 2006
How is the event declared? Does it have the "event" keyword?

Marc

 
Reply With Quote
 
=?Utf-8?B?U2hhd24=?=
Guest
Posts: n/a
 
      30th Dec 2006
Yes it does. Each of the user defined controls have the same declarations:

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

"Marc Gravell" wrote:

> How is the event declared? Does it have the "event" keyword?
>
> Marc
>
>

 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      1st Jan 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: invoking an event in one class (for which the event hanlder isin another class) Rick Lones Microsoft C# .NET 0 3rd Sep 2010 12:35 PM
Register a c# class James Microsoft C# .NET 6 26th Sep 2006 07:35 AM
Register a class =?Utf-8?B?TGlvbnJvdW5k?= Windows XP General 1 12th Sep 2005 02:20 PM
how to register a custom class name in c#? jay Microsoft Dot NET Framework 4 20th Feb 2004 09:38 PM
Re: How to register a .NET class library? Calvin Microsoft Dot NET 3 27th Aug 2003 09:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:56 PM.