473,804 Members | 3,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inherit and control properties.

I've written a control and Inherited a button but I only want to show
only the custom properties that I made. Is there a way to hide the
rest?

Aug 16 '07 #1
4 1332
hi, i think you can override each method and property you don't want to
expose

some like
pirvate overrides sub xyx(byval e as eventargs )
mybase.xyx(e)
end sub

and
private overrides property ...

etc.
I hope this helps.
Greetings, Sergio E.

<sh********@yah oo.comescribió en el mensaje
news:11******** **************@ d55g2000hsg.goo glegroups.com.. .
I've written a control and Inherited a button but I only want to show
only the custom properties that I made. Is there a way to hide the
rest?

Aug 17 '07 #2
On Thu, 16 Aug 2007 21:54:42 -0000, "sh********@yah oo.com"
<sh********@yah oo.comwrote:
>I've written a control and Inherited a button but I only want to show
only the custom properties that I made. Is there a way to hide the
rest?
If you don't want any of the button properties, then you should create
your class inherited from UserControl and drop a button into it.
Aug 17 '07 #3
sh********@yaho o.com wrote:
I've written a control and Inherited a button but I only want to show
only the custom properties that I made. Is there a way to hide the
rest?
Define "hide".
If you want to "remove" them so they're not accessible in code, then
strictly; no you can't. That would break the basic principles of
Inheritance.

If you just want to hide them from the Properties window, then you have
to override/shadow each and every one, decorating it with the
Browsable(False ) attribute.
To be honest, I wouldn't think this was worth the effort.

If you want to limit the properties/methods you get to play with in the
Intellisense while you're coding, look at creating an Interface that
includes these and declare your Button as the Interface Type, rather
than the actual Class, as in

Interface ICustomButton
Property ButtonText() as String
. . .
End Interface

Class CustomButton
Implements ICustomButton
. . .
Property ButtonText() As String _
Implements ICustomButton.B uttonText
. . .
End Class

Class Form1
Private btnCustom1 as ICustomButton _
= New CustomButton()
. . .

/But/ this almost certainly won't work in the Forms Designer within the
IDE!

HTH,
Phill W.
Aug 17 '07 #4
Shawn,

I never saw any solution for that.

The real controls have as well properties which you see that are inheritted,
some of those don't even work.
AFAIK is one of those the background color from the picturebox.

For the rest read Phil his reply.

Cor
Aug 17 '07 #5

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

Similar topics

7
19497
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
0
321
by: Prathiraj | last post by:
Hi All, Please let me know the steps one has to follow for successful inheritance of a control. An example would be to inherit an ImageButton server side control with OnClick functionality included. i.e., The user should be able to drag the control from the toolbox and use it in a web page with some defined properties, On the site, when the end user clicks the imagebutton, the controls onclick event should be fired and the desired...
6
2916
by: Mohammad-Reza | last post by:
I wrote a component using class library wizard. In my component i want to in order to RightToLeft property do some works. I can find out if user set this property to Yes or No, But if He/She set it to Inherit I must examine its parent RightToLeft property(if i`m wrong please tell me) but in this component that inherits from System.ComponentModel.Component, How can i find parent??? In UserControls we can simply use Parent property but in...
1
5972
by: Spurry Moses | last post by:
Hi, I'm converting a project from C++Builder to C# and I just need to copy my class design across. It's looking good so far. To stick with the design I want to inherit from a ComboBox control (ie MyComboBox). I don't need to do anything flash with it, just add a few properties and methods. I'd almost solved this while writing this post but I'll just confirm what I'm doing is OK. It was a bit awkward in Visual Studio because all of...
2
1124
by: Sehboo | last post by:
Can somebody please tell me how to inherit a DropDown box in asp.net C# - step by step. I just want to inherit DropDown box and then add few more properties and methods - but I just don't know how to inherit and make it appear on the toolbox, so that I can drag and drop it on my asp.net pages. It would also be benefial, if I could actually hide few of the original properties from DropDown (for example, if I want to hide Font property...
7
1756
by: Frank | last post by:
Hi, a question probably asked before, but I can't find the answers. Base class X, classes A, B and C inherit class X. In class A I do not want to inherit property (or function or method) P1. Possible? How? Thanks in advance Frank
5
2468
by: DAVE P | last post by:
i want to extend the progress bar control via inheritance my question is...in the ide how can i expose the inherited control for instance can i ad my inherited control in the tool box or is there a property that has control inherits from thanks dave
7
13682
by: wagger | last post by:
Hi! I am creating a set of static classes, one class for each "case" I have. The class should do and perform certain things, and the different static classes are doing different things. However, in each static class there must be 3 properties (id, name and description) and I thought I just create an abstract class and define them there and let all the static classes (ie the cases) inherit from that and thus forcing them to implement the...
2
2270
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
0
9584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
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
10337
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...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9160
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
5525
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
4301
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
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
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.