By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

Hiding Properties of Inheirited Classes

P: n/a
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.

Is there anyway that I can fix this?

--
Dennis in Houston
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Dennis,

You see that with the picturebox as well where in my opinion the
backgroundcolor is shadowed (hidden). When you shadows it and make it
private as the documentation says, than is my expirience that it takes the
property from the base class.

I have searched on Google for that and the only thing I found was setting
<browsable> to false, however that does not work as well in the IDE itself.

This does not help you hoever shows that you are not the only one who is
looking for a way to do this.

I hope that it helps in that way?

Cor

"Dennis" <De****@discussions.microsoft.com>
..
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked
as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.

Is there anyway that I can fix this?

--
Dennis in Houston

Nov 21 '05 #2

P: n/a
Dennis,

You see that with the picturebox as well where in my opinion the
backgroundcolor is shadowed (hidden). When you shadows it and make it
private as the documentation says, than is my expirience that it takes the
property from the base class.

I have searched on Google for that and the only thing I found was setting
<browsable> to false, however that does not work as well in the IDE itself.

This does not help you hoever shows that you are not the only one who is
looking for a way to do this.

I hope that it helps in that way?

Cor

"Dennis" <De****@discussions.microsoft.com>
..
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked
as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.

Is there anyway that I can fix this?

--
Dennis in Houston

Nov 21 '05 #3

P: n/a
"Dennis" <De****@discussions.microsoft.com> schrieb:
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked
as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.


You cannot completely remove the method -- this would stand against the
concepts of inheritance and extension by deriving. All you can do is
overriding (or maybe direclty shadowing) the method and specifying
'Browsable' and/or 'EditorBrowsable' attributes with appropriate value on
the member (these attributes are defined in the 'System.ComponentModel'
namespace).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

P: n/a
"Dennis" <De****@discussions.microsoft.com> schrieb:
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked
as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.


You cannot completely remove the method -- this would stand against the
concepts of inheritance and extension by deriving. All you can do is
overriding (or maybe direclty shadowing) the method and specifying
'Browsable' and/or 'EditorBrowsable' attributes with appropriate value on
the member (these attributes are defined in the 'System.ComponentModel'
namespace).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #5

P: n/a
Thanks for answers. Disappointing that VB.Net doesn't do what Microsoft says
it will.

"Dennis" wrote:
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.

Is there anyway that I can fix this?

--
Dennis in Houston

Nov 21 '05 #6

P: n/a
Thanks for answers. Disappointing that VB.Net doesn't do what Microsoft says
it will.

"Dennis" wrote:
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.

Is there anyway that I can fix this?

--
Dennis in Houston

Nov 21 '05 #7

P: n/a
Herfried brings up the attribute that you need in his reponse. The
EditorBrowsable attribute allows for 'hiding' a member from the auto list
feature in the IDE. You can select Never, Advanced, or Always. The Never
option will hide this method even if the IDE Setting under Tools->Options -
Text Editor All Languages (or individual language) shows the Hide advanced
members as unchecked.

One quirky thing about the EditorBrowsable setting is if a base class has
the method as browsable, and the derived does not, it will show the member
from the base class. This is confirmed by changing the case on the derived
class overridden or shadowed member. It will show the method character
casing from the base class, which has the browsable attribute allowing for
visibility in the auto list. This is strange, and a bit annoying.

The Browsable attribute allows for hiding within the design view property
window in the case of a custom control.

As far as the original article, 'hide' is the term that Microsoft uses in
this instance to specify that the method implementation is hidden when using
the derived class. The second part of the statement makes reference to this,
as it allows for changing the availability of the method from public to
private, or having new behavior. The method name itself was not hidden.

Hope this helps all.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I have a class named myclass that inheirits from "baseclass". There is a
property of "baseclass" that I don't want exposed in the IDE. The MSDN
documentation says"

"A derived type can hide an inherited member by defining a new member with
the same signature. This might be done to make a previously public member
private or to define new behavior for an inherited method that is marked
as
final. "

However, this does not hide the property. For example, in my code;

dim c as myclass = new myclass

when I type c. the designer shows all the properties and methods and it
includes the property that I have made private in myclass.


You cannot completely remove the method -- this would stand against the
concepts of inheritance and extension by deriving. All you can do is
overriding (or maybe direclty shadowing) the method and specifying
'Browsable' and/or 'EditorBrowsable' attributes with appropriate value on
the member (these attributes are defined in the 'System.ComponentModel'
namespace).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.