473,769 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using base class event handlers from the IDE

My UserControl base class has an event handling method in it. I want
to use this for several controls on a subclass of this base class.
Normally, I can just click on the drop-down and the methods that fit
the correct signature appear - however ones from the base class don't!

If I go in and change the generated code myself, it works - so things
are set up correctly - it just doesn't appear in the dropdown.

Anyone else encountered this?

Andy D

Nov 17 '05 #1
2 1447
Andy,

The reason this is is that the method is created with a private access
modifier, which means that it won't be available to classes that derive from
that.

Change the access modifier to protected and it should show up in the
list in the derived classes.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Andrew Ducker" <an****@ducker. org.uk> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
My UserControl base class has an event handling method in it. I want
to use this for several controls on a subclass of this base class.
Normally, I can just click on the drop-down and the methods that fit
the correct signature appear - however ones from the base class don't!

If I go in and change the generated code myself, it works - so things
are set up correctly - it just doesn't appear in the dropdown.

Anyone else encountered this?

Andy D

Nov 17 '05 #2
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in news:eb******** ******@TK2MSFTN GP15.phx.gbl:
Andy,

The reason this is is that the method is created with a private
access
modifier, which means that it won't be available to classes that
derive from that.

Change the access modifier to protected and it should show up in
the
list in the derived classes.


Nope - it was already protected - otherwise it wouldn't have worked when I
tweaked the code by hand. It does work if I go into the code and edit it -
it just doesn't come up from the IDE.

Andy D
Nov 17 '05 #3

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

Similar topics

19
676
by: Kamilche | last post by:
I have looked at many object-oriented programming frameworks out there for C. Though the ideas presented are intriguing, and I've used some of them in my own work, they all suffered some drawback or another. I have created a new method of doing OOP with C, something that fits my needs particularly well. I haven't encountered anything else like it, so I'm tossing it out to the Internet for comment. ...
13
2583
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the original System.Web.UI.Page in order to have common checks in the page base. i make securirty checks in the page base page_load event. if the security fails, i can do whatever i want before the "real" / derived page gets to be executed.
3
2150
by: NWx | last post by:
Hi, I defined a base class, Panel, based on System.Web.UI.UserControl, as below: Public MustInherit Class Panel Inherits System.Web.UI.UserControl ..... In another module, I want to define another custom control, Login, based on
8
2033
by: Raider | last post by:
I have simple class hierarchy (without multiple inheritance): class Base {}; class Derived : public Base {}; class DeepDerived : public Derived {}; // ... a lot of types Is it ok to cast void(Base*) to void(Derived*) if I know exactly what I will pass Derived* as a parameter? I want to register different handlers for different types using
0
1017
by: droyad | last post by:
I have recently upgraded a web project from ASP.NET 1.1 to ASP.NET 2.0, and now the event handlers no longer work, due to the event handlers being defined in base classes. To start a bit of background, below is a simplified example, but the same design pattern is used for many other pages: In the ASPX file a button is defined: <asp:Button Runat="server" Text="Login" id="btnLogin"></asp:Button>
7
1685
by: kenny.deneef | last post by:
Hey all We are working on a project and have alot of forms with textboxes on. Now we want to put some input validation keypress events on those textboxes. We got a parent class where we putted some event into ex. public void AlfaKeyPress(object sender, KeyPressEventArgs e) { // still have to put something into this e.Handled = false;
3
2166
by: =?Utf-8?B?RWR3aW4=?= | last post by:
Hello Everyone. Below is the code that is in question. --- BEGIN CODE WITHIN INHERITED FORM --- protected virtual void OnFormClosing(object sender, FormClosingEventArgs e) { switch (e.CloseReason) { case CloseReason.UserClosing: if (this.AskUserIfOkayToClose() == true) { this.ExecuteApplicationCloseProcedures(); }
1
3366
by: AliR \(VC++ MVP\) | last post by:
Hi Everyone, I have a few form classes that inherit from the same base class. The main reason that this is done is that some event handlers are common between these classes and I was trying to save time and not have to put a event handler in every form class. The base class has an event handler for Edit.Enter and Edit.Leave so that it can turn the Edit menu items on and off.
14
2974
by: raylopez99 | last post by:
KeyDown won't work KeyPress fails KeyDown not seen inspired by a poster here:http://tinyurl.com/62d97l I found some interesting stuff, which I reproduce below for newbies like me. The main reason you would want to do this is for example to trigger something from an OnPaint event without resorting to boolean switches-- say if a user presses the "M" key while the program is Painting, the user gets the PaintHandler to do something else. ...
0
1263
by: ma740988 | last post by:
Consider # include <iostream> # include <vector> # include <typeinfo> # include <string> class BaseMsg { friend std::ostream& operator<<( std::ostream&, const BaseMsg& ); std::string name ;
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.