Solved

Hiding a property

Posted on 2004-09-01
3
265 Views
Last Modified: 2010-04-15
Hi everyone ..

I have a control NumericTextBox which is inherited from TextBox. Now, TextBox has a property named .Text which I would like to hide from the programmer.

So if the user adds a NumerictextBox to his form, there should be no option .Text

NumericTextBox myNtb = new NumericTextBox();
myNtb.Font ... works
myNtb.Size ... works
myNtb.Text ... doesn't exist


Is there any way how I can do that ?
0
Comment
Question by:somnatic
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11951711
You can't ... the only thing you could do is override the .Text method ...

There is reason for this though. If you could inherit from a class to remove functionality (i.e. externally visible items) you would break polymorphism.
0
 
LVL 4

Author Comment

by:somnatic
ID: 11951769
ok, already thought so .. only couldn't think of a reason ..

but now that's clear .. makes sense as well :)
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11951805
glad to help.

Cheers,

Greg
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now