473,626 Members | 3,467 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 22 '05 #1
3 1670
"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 22 '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 22 '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 22 '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
1096
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 method. This doesn't work and even the release version of the software also doesn't work. Following...
0
1395
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: Syed Zaidi ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/) ...
0
1525
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 they see a dropdown list of available controls and select one and save the page, kind of irrelevant to...
3
3100
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 when the mouse is over the control itself, and not when it is over the standard controls....
0
1448
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 usercontrol; secondlywants to override the methods of usercontrol in winformaccordingly to the click event of...
2
2781
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 navigation methods of user control. Forexample to add some custom functionality for moving to first...
5
1635
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
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.
7
3634
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
8268
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
8707
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
8510
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
7199
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...
1
6125
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4093
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...
1
2628
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
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.