473,387 Members | 1,431 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.

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 21 '05 #1
3 2431
"Tee" <th*@streamyx.com> wrote in message
news:ud**************@TK2MSFTNGP10.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 21 '05 #2
Tee
I'm not inheriting it ...

Any idea?
"Sean Hederman" <us***@blogentry.com> wrote in message
news:ct**********@ctb-nnrp2.saix.net...
"Tee" <th*@streamyx.com> wrote in message
news:ud**************@TK2MSFTNGP10.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 21 '05 #3
"Tee" <th*@streamyx.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
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***@blogentry.com> wrote in message
news:ct**********@ctb-nnrp2.saix.net...
"Tee" <th*@streamyx.com> wrote in message
news:ud**************@TK2MSFTNGP10.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 21 '05 #4

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

Similar topics

3
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...
0
by: DotNetBBK | last post by:
Hi, I am using a custom text box, where I need to override TabSelection, as I have to generate an event and based on that event, I need to do some processing in other class, who is listening to...
0
by: Syed Zaidi via .NET 247 | last post by:
How to get a custom toolbar buttons on vb.net winform and how to override it. Suppose we put a toolbar on usercontrol. And want to code or enhance the functionality of the buttons or in simple want...
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
3
by: Charles Law | last post by:
In a user control, is it possible to replace the default mouse events with my own? In particular, I want the consumer of my control to get MouseMove events when the mouse is over my control, so...
0
by: Syed Zaidi via .NET 247 | last post by:
I am working on a small project in which i want to develop acustom toolbar skeleton for handling database navigation. I havecreated a usercontrol consist of a toolbar inherits fromusercontrol and...
2
by: Syed Zaidi | last post by:
Hello All I am a newbie in VB.NET and wanting to create a toolbar(User Control) for Database Navigation. What exactly I want is to have a user control which is inherited from the...
5
by: Dom | last post by:
I have a usercontrol, and I am trying to write a Property called "Text", but the compiler tells me that the Usercontrol class already has a member called "Text". When I look (in intellisense, or...
1
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...
7
by: =?Utf-8?B?cmFtbzk5NDE=?= | last post by:
Hi, Is there any way disable using "protected override void OnPaint(..." method out of the assembly. I create usercontrol and i do not want user adds extra codes OnPaint method for securtity...
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: 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...
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
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
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.