473,491 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Make inherited property invisible

Hi all,

I have made a usercontrol and I want to prevent the ContextMenuStrip
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStrip as Object

But I can always still see the property in the designer, can anyone help me
out with this?

Kind regards,

Martin.
Dec 22 '06 #1
5 1779
How about Private instead of Protected?
"Martin" <@ntlworld.comwrote in message
news:_0*******************@newsfe4-gui.ntli.net...
Hi all,

I have made a usercontrol and I want to prevent the ContextMenuStrip
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStrip as Object

But I can always still see the property in the designer, can anyone help
me out with this?

Kind regards,

Martin.


Dec 22 '06 #2
No that doesn't work either, I had already tried it.

here is an example:

Public Class Class1
Inherits ListView

Private Shadows ContextMenuStrip As Object

<System.ComponentModel.Browsable(False)_
Private Shadows Property Forecolor() As Color
Get
End Get
Set(ByVal value As Color)
End Set
End Property

<System.ComponentModel.Browsable(False)_
Private Shadows FullRowSelect As Object
End Class

All 3 overridden properties still show up in the designer, is there any way
around this?

Thanks.
"Scott M." <s-***@nospam.nospamwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
How about Private instead of Protected?
"Martin" <@ntlworld.comwrote in message
news:_0*******************@newsfe4-gui.ntli.net...
>Hi all,

I have made a usercontrol and I want to prevent the ContextMenuStrip
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStrip as Object

But I can always still see the property in the designer, can anyone help
me out with this?

Kind regards,

Martin.



Dec 22 '06 #3
Hi all,

I'm still trying to figure this out with no success yet.

I've created a user control that contains a listview; To work as I want it
to, it relies on the the columns and contextmenu being set up in a
particular way, and I would therefore like to prevent consumers of my
control from accessing those properties directly.

So far I have been unable to find a way of hiding/overriding these
properties in the visual design environment.

Could anyone at least tell me that it can't be done, in which case I'll be
disappointed, but at least I can stop wasting anymore time on this aspect of
the design.

Sorry to keep on about this, but I was hoping someone could at least give me
a definitive answer one way or the other.

Kind regards,

Martin.
Dec 22 '06 #4
Martin wrote:
I have made a usercontrol and I want to prevent the ContextMenuStrip
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStrip as Object

But I can always still see the property in the designer, can anyone help me
out with this?
To suppress properties in the Designer, use the Browsable attribute, as in

Imports System.ComponentModel

<Browsable(False)_
Protected Shadows ContextMenuStrip as Object

But, this property will still get included in the "Designer Generated"
code. If you're developing this Control over time (i.e. while other
people are developing app's that use it), you might want to prevent
this, especially for new properties. If you don't, and their app's get
"ahead" of your usercontrol, their constructors can fail with
MissingMethodExceptions.
To suppress this code being generated, use the
DesignerSerializationVisiblity attribute, as in

Imports System.ComponentModel

' Sorry about the /ridiculously/ long names!
<Browsable(False),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden) _
Protected Shadows ContextMenuStrip as Object

HTH,
Phill W.
Dec 22 '06 #5
Phill,

that did the trick, thanks so much!

I also used your example to work out how to stop intellisence from showing
it in the code window like so...

<EditorBrowsable(EditorBrowsableState.Never), Browsable(False),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)_
Public Overrides Property ContextMenuStrip() As
System.Windows.Forms.ContextMenuStrip
Get
' My own code
End Get
Set(ByVal value As System.Windows.Forms.ContextMenuStrip)
'My own code
End Set
End Property
Once again, thanks!

"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:em**********@south.jnrs.ja.net...
Martin wrote:
>I have made a usercontrol and I want to prevent the ContextMenuStrip
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStrip as Object

But I can always still see the property in the designer, can anyone help
me out with this?

To suppress properties in the Designer, use the Browsable attribute, as in

Imports System.ComponentModel

<Browsable(False)_
Protected Shadows ContextMenuStrip as Object

But, this property will still get included in the "Designer Generated"
code. If you're developing this Control over time (i.e. while other
people are developing app's that use it), you might want to prevent this,
especially for new properties. If you don't, and their app's get "ahead"
of your usercontrol, their constructors can fail with
MissingMethodExceptions.
To suppress this code being generated, use the
DesignerSerializationVisiblity attribute, as in

Imports System.ComponentModel

' Sorry about the /ridiculously/ long names!
<Browsable(False),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)>
_
Protected Shadows ContextMenuStrip as Object

HTH,
Phill W.

Dec 22 '06 #6

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

Similar topics

2
1952
by: john | last post by:
I have some controls that I want to be invisible, but if the user does something, they will become visible using javascript. So I can't set its "visible" property to false, because then they won't...
4
7104
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
2
1722
by: Michael Chong | last post by:
Hi, How can I make a column in Datagrid invisible programmatically during run-time? I did try the following but doesn't work. DataGridLedger.DataSource = myDataSet DataGridLedger.DataMember =...
15
3733
by: John Blair | last post by:
Hi, Code attached but the line that gives me an error is MyDataGrid.Columns(2).Visible = False It actually gives me an error for any value instead of 2 even when 9 bound columns of data exist....
6
14671
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
4
2452
by: NH | last post by:
Hi, I just cannot get this to work. I want to make a cell editable in a datagrid only if the value of another cell is something specific. I am able to capture the value of the other cell via the...
3
5937
by: Neo | last post by:
I am going to make SDI base application in MFC, which has a button for "New Window", will show new window with different view. How I can solve this problem? Main window view class inherited...
4
1937
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on...
7
7009
by: Nader | last post by:
It's easy to make the last row in a datagrid (filled with a table) invisible: datagridObject.Rows.Visible = false BUT if 'i' is not the last row then things go wrong. I even tried: for...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.