473,394 Members | 1,645 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,394 software developers and data experts.

Inheritance and events

Hi,

My problem is in trying to extend events in the inheritance heirarchy. I
have a custom control. It has 3 images on it. The custom control consumes the
Click event. In the Click event of each of the images I fire the Click event
of the control. Let's call the control custom_ancestor. I set the images to
have protected access.

Now I inherit from this custom_ancestor and change the bitmaps to something
that I want for a specific application. Let's say that I call this image_new.

Now I put image_new on a form. I call it custom1 on the form. I go to the
clicked event and add some code. That code never gets fired off.

I've read through a lot of web sites and tried the help files. I've changed
modifiers back and forth. I've put messageboxes everywhere and taken them out.

Can someone please help me out here? I'm stuck. I just want the click event
of the object in the form to be fired when the clicked event of the topmost
ancestor is fired.

Thanks in advance.
--
Outside of a dog, a book is man's best friend. Inside a dog it's too dark to
read
Nov 16 '05 #1
1 1781
Rik Brooks <Ri*******@discussions.microsoft.com> wrote:
My problem is in trying to extend events in the inheritance heirarchy. I
have a custom control. It has 3 images on it. The custom control consumes the
Click event. In the Click event of each of the images I fire the Click event
of the control. Let's call the control custom_ancestor. I set the images to
have protected access.

Now I inherit from this custom_ancestor and change the bitmaps to something
that I want for a specific application. Let's say that I call this image_new.

Now I put image_new on a form. I call it custom1 on the form. I go to the
clicked event and add some code. That code never gets fired off.

I've read through a lot of web sites and tried the help files. I've changed
modifiers back and forth. I've put messageboxes everywhere and taken them out.

Can someone please help me out here? I'm stuck. I just want the click event
of the object in the form to be fired when the clicked event of the topmost
ancestor is fired.


I'm having trouble imagining the code you've got.
Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

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

Similar topics

1
by: KK | last post by:
Windows Forms Inheritance, Incomplete? I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can be used effectively if the...
2
by: KK | last post by:
** Posting it here cause after couple of days no body responded.** I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
8
by: JPRoot | last post by:
Hi M. Jeffrey Tan, Just hopping you didn't forget me? :) Thanks JPRoot ----- \"Jeffrey Tan\" wrote: -----
7
by: Hazz | last post by:
Are there any good references/articles/books which provide clarity toward my insecurity still on deciding how to model a complex system? I still feel uncomfortable with my understanding, even...
14
by: Bruno van Dooren | last post by:
Hi all, i am having a problems with inheritance. consider the following: class A { public: A(int i){;} };
1
by: Jeremy.Deats | last post by:
I have been programming in C# for the past few years and I'm now trying to implement something in VB.NET (Framework 1.1) that I'm having a problem with... In C# I can create a new class and make...
1
by: Tom Rahav | last post by:
Hi, I use VB .NET 2003 and I want to create a new UserControl that will function as a "smart" combobox that handles few events automatically (such as auto-complete, etc.) in addition to the...
4
by: Tim | last post by:
There are a set of clients who need to be notified of certain events. I have used events and delegates (publisher-Subscriber model) for the notification mechanism. All the clients register with...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.