473,324 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to remove a Property/Function/Sub

Hello

I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?

Thanx for suggestions :-)
Nov 20 '05 #1
4 1498
You can make the functions private. Thus, B will not be able to use them.

However, if you have other classes inheriting from A, and some of them do
need these items, then you may want to rethink your hierarchy.

"Captain Chaos" <no****@nospam.com> wrote in message
news:bt*************@news.t-online.com...
Hello

I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?

Thanx for suggestions :-)

Nov 20 '05 #2
* "Captain Chaos" <no****@nospam.com> scripsit:
I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?


That's breaking the inheritance hierarchy and it's not possible.
Something which is inherited, will be available in all subclasses. You
will have to rethink the design of your class hierarchy.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

Thanx, I think you are right and I would give the same answer to myself :-)

But I can not rethink of the other design........

I have no access to the Code of Class A !

That's the Problem.........

Well, and now ?

I thought about hiding Property/Function/Sub/Event via Attributes.

The Problem is that I can only hide the the ones of Class B
and even if i shadowing the Properties of A in B they are not hidden.

I have tried these Attributes:
<ComponentModel.EditorBrowsable(ComponentModel.Edi torBrowsableState.Never),
ComponentModel.Browsable(False),
ComponentModel.DesignerSerializationVisibility(Com ponentModel.DesignerSerial
izationVisibility.Hidden)> _

Seams the only solution is to shadow it and set it obsolete

and fire an error if somebody using it.
But that's not very nice......
My UserControl for example has no Click Event...........
But the Windows.Forms.UserControl has it.........
Any many other useless Properties that nobody neads and confusing my
Customers using my Control.......

Should I rebuild the Class "Windows.Forms.UserControl" myself ?
Is this possible ? And How ?

Thanx anyway :-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:ef**************@TK2MSFTNGP11.phx.gbl...
* "Captain Chaos" <no****@nospam.com> scripsit:
I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?


That's breaking the inheritance hierarchy and it's not possible.
Something which is inherited, will be available in all subclasses. You
will have to rethink the design of your class hierarchy.

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

Nov 20 '05 #4

I tried to make it Privatein Class B:

Private Shadows Property AcceptButton() As Windows.Forms.IButtonControl
But I see the Property anyway if i use Class B:

I think then it takes the Property of Class A......

"Marina" <so*****@nospam.com> schrieb im Newsbeitrag
news:O5**************@TK2MSFTNGP10.phx.gbl...
You can make the functions private. Thus, B will not be able to use them.

However, if you have other classes inheriting from A, and some of them do
need these items, then you may want to rethink your hierarchy.

"Captain Chaos" <no****@nospam.com> wrote in message
news:bt*************@news.t-online.com...
Hello

I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?

Thanx for suggestions :-)


Nov 20 '05 #5

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

Similar topics

1
by: Steve S | last post by:
I need some help modifying this code. The code was orginally setup to add/remove a single table row. I modified it to add 2 (two) rows with one column that spans both rows. That part works. I...
1
by: m. pollack | last post by:
Hi all, I'm still trying to get to the bottom of the problem I am having with the CollectionBase class and the Object Collection Editor. Briefly put, I am exposing a strongly-typed collection...
20
by: Steve Jorgensen | last post by:
A while back, I started boning up on Software Engineering best practices and learning about Agile programming. In the process, I've become much more committed to removing duplication in code at a...
12
by: Mika M | last post by:
Customer wants the Close (X)-button of the forms top right corner to be Disabled or removed from Windows Form-application, which is made using VB.NET, but leave MinimizeBox and MaximizeBox. I...
6
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially...
11
by: Richard Maher | last post by:
Hi, I have read many of the copius entries on the subject of IE performance (or the lack thereof) when populating Select Lists. I don't mind the insert performance so much, (I get 100x120byte...
1
by: abyclassic | last post by:
Dear All, I am making a Windows Control Library(user control) using VS.NET & C#.NET. Now, i am facing 3 problems: 1.In this control, i wants to remove some of the properties which are available...
11
by: David | last post by:
Hi All, I am working on a script that is theoreticaly simple but I can not get it to work completely. I am dealing with a page spit out by .NET that leaves empty tags in the markup. I need a...
4
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.