468,556 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,556 developers. It's quick & easy.

Hiding Inherited properties

Hi,

I've develpped a reusable UserControl. The only headache it's giving me is
how to hide the inherited properties such as AutoScroll, DockPadding, etc...
wich could cause some visual Anoyances on my control.I've tried

<System.ComponentModel.Browsable(False),
System.ComponentModel.EditorBrowsable(System.Compo nentModel.EditorBrowsableS
tate.Never),
System.ComponentModel.DesignerSerializationVisibil ity(System.ComponentModel.
DesignerSerializationVisibility.Hidden)>

This way the properties are not visible at the property grid, but they are
visible when writting the code (Intelisense). Is there another way to get
rid of them?

Thank you in advance
Nov 21 '05 #1
2 1159
Juan,

This is often asked, there has not been a Yes answer with description yet.

You can see it in the standard classes also. If you set the
textbox.backcolor, you can set it, however because of the fact that the
textbox has no background, it does nothing. It is not set the propertygrid,
however you can set it in code as often as you want.

I hope this helps,

Cor
Nov 21 '05 #2
"Juan Pedro Gonzalez" <th******@terra.es> wrote in message
news:Oc*************@TK2MSFTNGP14.phx.gbl...
The only headache it's giving me is how to hide the inherited
properties .. . . This way the properties are not visible at the property grid, but
they are visible when writting the code (Intelisense). .. . . Is there another way to get rid of them?


No. That's one of the basic tenets of Inheritance.

However, you might be able to "side-step" this by declaring
an Interface for your control and creating "duplicate" variables
for each actual control that are defined as the Interface Type,
something like

Interface ITinyTextBox
Property Enabled() As String
Property Text() As String
End Interface

Class myTextBox
Inherits Forms.TextBox
Implements ITinyTextBox
. . .

Then, in your form, the Forms Designer will write

Friend WithEvents txtThing As myTextBox
. . .
txtThing = New myTextBox

Then you can add

Private txtSimpleThing as ITinyTextBox _
= DirectCast( txtThing, ITinyTextBox )

Then use txtSimpleThing in place of txtThing:

Me.txtSimpleThing.Text = ...

And all you'll see are the things defined in the Interface.

HTH,
Phill W.
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by thechaosengine | last post: by
4 posts views Thread by A Ratcliffe | last post: by
4 posts views Thread by Dan | last post: by
1 post views Thread by Juan Pedro Gonzalez | last post: by
2 posts views Thread by Steven Nagy | last post: by
5 posts views Thread by PIEBALD | last post: by
14 posts views Thread by Dom | last post: by
9 posts views Thread by Torben Laursen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.