473,626 Members | 3,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to override a method in usercontrol?

Tee
Hi,

I have a usercontrol with a overridable/virtual method. On the usercontrol
onload, it will call this method.

Now I have a form that have a few of this usercontrol.
And I want to override the method in each usercontrol, how do I accomplish
this?
Thanks,
Tee
Nov 16 '05 #1
3 2270
"Tee" <th*@streamyx.c om> wrote in message
news:ud******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a usercontrol with a overridable/virtual method. On the usercontrol
onload, it will call this method.

Now I have a form that have a few of this usercontrol.
And I want to override the method in each usercontrol, how do I accomplish
this?
public class ChildControl : ParentControl {

public override void MyMethod() {
base.MyMethod() ;
}

}


Thanks,
Tee

Nov 16 '05 #2
Tee
I'm not inheriting it ...

Any idea?
"Sean Hederman" <us***@blogentr y.com> wrote in message
news:ct******** **@ctb-nnrp2.saix.net. ..
"Tee" <th*@streamyx.c om> wrote in message
news:ud******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have a usercontrol with a overridable/virtual method. On the usercontrol onload, it will call this method.

Now I have a form that have a few of this usercontrol.
And I want to override the method in each usercontrol, how do I accomplish this?


public class ChildControl : ParentControl {

public override void MyMethod() {
base.MyMethod() ;
}

}


Thanks,
Tee


Nov 16 '05 #3
"Tee" <th*@streamyx.c om> wrote in message
news:%2******** **********@TK2M SFTNGP14.phx.gb l...
I'm not inheriting it ...

Any idea?
Overriding is a property of derived classes, so if you're not inheriting it,
AFAIK you can't override it. If you have access to the source of the
controls you could change them to call a delegate instead of the overridable
method, and then make that delegate settable from outside the control. It
would be a pretty nasty solution though.
"Sean Hederman" <us***@blogentr y.com> wrote in message
news:ct******** **@ctb-nnrp2.saix.net. ..
"Tee" <th*@streamyx.c om> wrote in message
news:ud******** ******@TK2MSFTN GP10.phx.gbl...
> Hi,
>
> I have a usercontrol with a overridable/virtual method. On the usercontrol > onload, it will call this method.
>
> Now I have a form that have a few of this usercontrol.
> And I want to override the method in each usercontrol, how do I accomplish > this?


public class ChildControl : ParentControl {

public override void MyMethod() {
base.MyMethod() ;
}

}
>
>
> Thanks,
> Tee
>
>



Nov 16 '05 #4

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

Similar topics

3
334
by: Tee | last post by:
Hi, I have a usercontrol with a overridable/virtual method. On the usercontrol onload, it will call this method. Now I have a form that have a few of this usercontrol. And I want to override the method in each usercontrol, how do I accomplish this?
3
2437
by: Tee | last post by:
Hi, I have a usercontrol with a overridable/virtual method. On the usercontrol onload, it will call this method. Now I have a form that have a few of this usercontrol. And I want to override the method in each usercontrol, how do I accomplish this?
3
1670
by: Tee | last post by:
Hi, I have a usercontrol with a overridable/virtual method. On the usercontrol onload, it will call this method. Now I have a form that have a few of this usercontrol. And I want to override the method in each usercontrol, how do I accomplish this?
1
3095
by: Joshua | last post by:
I'm creating a web control that has an image and a text box. I would like to then override the Visible and Text property of the usercontrol, so when you reference the visible property of the user control it only set the visible property of the textbox. When i call these newly created property I get the following error: Object reference not set to an instance of an object. Does anybody have any idea? Thank you.
0
8266
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
8705
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
8638
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8505
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
7196
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...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.