473,325 Members | 2,805 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,325 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 22 '05 #1
3 1654
"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 22 '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 22 '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 22 '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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.