473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can you make a class register an event?

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.
Dec 30 '06 #1
3 1527
How is the event declared? Does it have the "event" keyword?

Marc

Dec 30 '06 #2
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

Dec 30 '06 #3
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

Jan 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bren | last post by:
I'm hoping somebody can help me with the following problem. I'm hoping it's not insurmountable. Here's a basic structure: class EventTarget { public: EventTarget(); virtual ~EventTarget();
6
by: newbie_csharp | last post by:
Hi, I have a class structure like this: rootform : System.Windows.Forms.Form midiform : rootform child1 : rootform child11 : child1 child2 : rootform chld21 : child2
8
by: John E Katich | last post by:
When attempt to use the Event Wizard I get the following error message: "Add/Remove of the function impossible, because the parent class code is read only" The Project was convert from VC 6.0....
2
by: bonk | last post by:
Hello, I have a managed type that defines an Event as one of its public members. Is it possible for an unmanaged c++ class to register to that event ? How can an unmanaged classmethod be called...
6
by: Max | last post by:
Last time I tried to explain this on another forum it didn't go too well, so I'll try my best and if you know what I'm talking about then please tell me how to do this. I have a class, inside I...
1
by: Bob | last post by:
Hi, I am having trouble seeing how this bolts together. The UI starts a process which involves a long running database update. All Database activity is handled by a class called DT. DT has a...
2
by: yashgt | last post by:
On a page, I need to show one item at a time. The top of the page has a Previous-Next control, followed by the item being shown, followed by another Previous-Next control. I have created a P-N user...
21
by: John Henry | last post by:
Hi list, I have a need to create class methods on the fly. For example, if I do: class Dummy: def __init__(self): exec '''def method_dynamic(self):\n\treturn self.method_static("it's...
6
by: Sourabh Daptardar | last post by:
Why is register storage specifier not allowed for class member variables? <snip> ISO standard : Section 9.2 ; point 6 : -6- A member shall not be auto, extern, or register. </snip> I...
4
by: Linda Liu[MSFT] | last post by:
Hi Moondaddy, I downloaded your sample project and run it and did see the problem on my side. There're three problems in the source code of your project. 1. You should move the following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.