Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ActiveX User-controls VB.NET , +
Dear all
I am creating a numerical text box control and named it NumTextbox, but when I create an object from it, I saw the UserControl events in the object with my custom events, so I want to prevent the object to inherits the UserControl events, methods and properties, I want it to inherits my own only.
 
I don't want to use NotInheritable (vb.net) or Sealed (C#) key words, because if you have class A, and class B that inherited from A but it is NotInderitable, that means no class can be inherited form B.
That is not what I want, I want to prevent the developer to see the UserControl events, properties or methods when he is in view code editor (the events combobox in code editor) if he add an object from that ActiveX control on the form. I want to display my own events only, not the UserControl events.
Did you got my idea?
Can anybody help me please?
Posted 3-Dec-11 10:47am
Comments
Philippe Mori at 3-Dec-11 17:44pm
   
I think it is mainly a waste of time to do that. What the problem with inheriting a few extra events. If you uses standard controls, you get some events, properties and methods you might never use but it does not matters much.
 
By the way, I think it is possible to hide them but the user could probably get to them by passing through the base class first.
CDP1802 at 3-Dec-11 19:30pm
   
And, if some functionality of the base class somehow is in the way, the right way to go would be to overload them with a new implementation that does work.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to go back the fundamentals of OOP and make sure you understand them and are comfortable to use them on practice, before returning to UI development or any other advanced issues. At the moment, you have no idea of how OOP works.
 
Every single member of the base class is inherited by the derived class. Nothing can prevent it, ever; and nobody wants to prevent it, ever. The class can only be extended, but some methods can be virtual and overridden, see the second link below.
 
It has nothing to do with NotInheritable and sealed. These keywords prevent inheriting from the class as a while thing. Derived classes are not possible at all in this case.
 
http://en.wikipedia.org/wiki/Object-oriented_programming[^],
http://en.wikipedia.org/wiki/Dynamic_dispatch[^].
 
As to your problem, it simply does not exist. The only problem is that you want something you should not want. You did not provide any rational reasons.
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 320
1 Sergey Alexandrovich Kryukov 222
2 OriginalGriff 155
3 Peter Leow 115
4 Afzaal Ahmad Zeeshan 114
0 OriginalGriff 7,510
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 5,044
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 4 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100