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

Inheriting an event handler

If I have an event handler defined in a base class form, why can I not
choose from it in the properties window of the descendant forms? I used to
use this all the time in Delphi.

Also, if I have to manually declare it in the child form and then pick it in
the properties window of the child, is this the correct way to do it:

protected override void bsrcMain_PositionChanged(object sender, EventArgs e)
{
// call base class code
base.bsrcMain_PositionChanged(sender, e);
// new code for this instance
FillAcctInfo();
}

TIA,

Mike Rodriguez
Nov 17 '05 #1
2 1484
Michael,

Hmm, I tried this in VS.NET 2005, and I would think that protected
members that fit the signature for an event handler would be listed, but it
is not. I'll have to list it as a bug. This also helped me discover
another bug.

I'll list them later tonight. Unfortunately, you will have to do this
manually until it is fixed.

As for how to do it, what you are doing looks correct, as long as the
method is declared virtual in the base class.

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

"Michael Rodriguez" <mi**@nospamforme.com> wrote in message
news:Ob**************@TK2MSFTNGP15.phx.gbl...
If I have an event handler defined in a base class form, why can I not
choose from it in the properties window of the descendant forms? I used
to use this all the time in Delphi.

Also, if I have to manually declare it in the child form and then pick it
in the properties window of the child, is this the correct way to do it:

protected override void bsrcMain_PositionChanged(object sender, EventArgs
e)
{
// call base class code
base.bsrcMain_PositionChanged(sender, e);
// new code for this instance
FillAcctInfo();
}

TIA,

Mike Rodriguez

Nov 17 '05 #2
Thanks, Nicholas. I'm glad to hear that it should be working this way.
I'll log the bug on the msdn feedback site. Who knows, maybe I'll win a 2nd
t-shirt... <g>

Mike
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:es**************@TK2MSFTNGP10.phx.gbl...
Michael,

Hmm, I tried this in VS.NET 2005, and I would think that protected
members that fit the signature for an event handler would be listed, but
it is not. I'll have to list it as a bug. This also helped me discover
another bug.

I'll list them later tonight. Unfortunately, you will have to do this
manually until it is fixed.

As for how to do it, what you are doing looks correct, as long as the
method is declared virtual in the base class.

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

"Michael Rodriguez" <mi**@nospamforme.com> wrote in message
news:Ob**************@TK2MSFTNGP15.phx.gbl...
If I have an event handler defined in a base class form, why can I not
choose from it in the properties window of the descendant forms? I used
to use this all the time in Delphi.

Also, if I have to manually declare it in the child form and then pick it
in the properties window of the child, is this the correct way to do it:

protected override void bsrcMain_PositionChanged(object sender, EventArgs
e)
{
// call base class code
base.bsrcMain_PositionChanged(sender, e);
// new code for this instance
FillAcctInfo();
}

TIA,

Mike Rodriguez


Nov 17 '05 #3

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

Similar topics

18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
10
by: Opa | last post by:
I have tried for two days to solve this problem with no luck. I have a singleton class which has some events declared. When I inherit from this class the events don't seem to come along with it....
5
by: Billy | last post by:
I created a form, BaseForm, with a button as sort of a base class for some future windows. I added a button and put a simple MsgBox in the _click event that says "Hi from base" and I set the...
3
by: Roy Soltoff | last post by:
Two books, "Mastering Visual Basic.Net" and "Visual Basic.Net Developer's Handbook" describe inheriting from System.EventArgs using a class similar to: Public Class MyEventArgs Inherits...
5
by: Andrew Robinson | last post by:
I am attempting to better automate a Pager Template within a GridView. I am succesfully skinning a Drop Down List withing my control (the DDL is added to my control). I correctly populate the item...
4
by: Soulless | last post by:
Hi, I have a form that I need to place 3 buttons on. I would like the 3 buttons to call the same method, perhaps with different arguments. In Powerbuilder, I could create a visual button...
7
by: Alex Gusarov | last post by:
Hello, I have strong .NET background with C# and want to do some familiar things from it with Python, but don't know how. For example, I created form in qt designer with QCalendarWidget, translated...
0
by: David Boddie | last post by:
On Mon May 26 17:37:04 CEST 2008, Alex Gusarov wrote: Right. I vaguely remember someone showing something like this at EuroPython a couple of years ago. I believe that this approach is actually...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.