Solved

Hiding a property

Posted on 2004-09-01
3
264 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
Comment Utility
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
Comment Utility
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
Comment Utility
glad to help.

Cheers,

Greg
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

11 Experts available now in Live!

Get 1:1 Help Now