473,563 Members | 2,767 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 21 '05 #1
3 2434
"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 21 '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 21 '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 21 '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?
0
1094
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 that event. This thing works fine, when I am stopping in the debugger for the event, but as soon as I remove the breakpoint from the event handler...
0
1390
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 to override that usercontrol toolbar button on client windows forms who uses or inherits that user contorl. -------------------------------- From:...
0
1523
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 a webcontrol which allows a admin user to select a usercontrol to include within a page when in "edit mode". When a user is editing the page...
3
3096
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 that they can change the cursor. However, my control has several standard controls on it, and the consumer of my control only gets MouseMove events...
0
1440
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 winform holding that control. First I want toaccess the Click functionality of each toolbar button(usercontrol) in my winform which holding the...
2
2776
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 system.windows.forms. usercontrol and contain a toolbar which have buttons for navigating records. And the client Windows Form which owns that control must overrides the...
5
1630
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 help) I don't see the member. I can easily override or make it new, but I'd like to know what is going on. Dom
1
3086
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...
7
3630
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 purpose. And i don't give a permission to call "CreateGraphics()". Thanks your responses.
0
7665
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...
0
7888
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. ...
0
8106
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...
0
7950
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...
1
5484
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...
0
5213
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
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
1200
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.