473,756 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make inherited property invisible

Hi all,

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

I have tried stuff like
Protected Shadows ContextMenuStri p 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 1796
How about Private instead of Protected?
"Martin" <@ntlworld.comw rote in message
news:_0******** ***********@new sfe4-gui.ntli.net...
Hi all,

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

I have tried stuff like
Protected Shadows ContextMenuStri p 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 ContextMenuStri p As Object

<System.Compone ntModel.Browsab le(False)_
Private Shadows Property Forecolor() As Color
Get
End Get
Set(ByVal value As Color)
End Set
End Property

<System.Compone ntModel.Browsab le(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.nosp amwrote in message
news:Or******** ******@TK2MSFTN GP06.phx.gbl...
How about Private instead of Protected?
"Martin" <@ntlworld.comw rote in message
news:_0******** ***********@new sfe4-gui.ntli.net...
>Hi all,

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

I have tried stuff like
Protected Shadows ContextMenuStri p 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 ContextMenuStri p
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStri p 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.Componen tModel

<Browsable(Fals e)_
Protected Shadows ContextMenuStri p 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
MissingMethodEx ceptions.
To suppress this code being generated, use the
DesignerSeriali zationVisiblity attribute, as in

Imports System.Componen tModel

' Sorry about the /ridiculously/ long names!
<Browsable(Fals e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden) _
Protected Shadows ContextMenuStri p 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...

<EditorBrowsabl e(EditorBrowsab leState.Never), Browsable(False ),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)_
Public Overrides Property ContextMenuStri p() As
System.Windows. Forms.ContextMe nuStrip
Get
' My own code
End Get
Set(ByVal value As System.Windows. Forms.ContextMe nuStrip)
'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.j a.net...
Martin wrote:
>I have made a usercontrol and I want to prevent the ContextMenuStri p
property from being available, how can I do this?

I have tried stuff like
Protected Shadows ContextMenuStri p 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.Componen tModel

<Browsable(Fals e)_
Protected Shadows ContextMenuStri p 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
MissingMethodEx ceptions.
To suppress this code being generated, use the
DesignerSeriali zationVisiblity attribute, as in

Imports System.Componen tModel

' Sorry about the /ridiculously/ long names!
<Browsable(Fals e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)>
_
Protected Shadows ContextMenuStri p 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
1967
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 even be rendered in the page at all. I can set them to invisible using javascript, but I don't want to do that because then their visibility isn't saved in the viewstate. Is there any way to make them invisible from the code-behind file in a way...
4
7125
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, image N, the panel N becomes visible and all the other invisible.
2
1738
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 = "ParentTable" DataGridLedger.DataBind() DataGridLedger.Visible = True DataGridLedger.Columns(1).Visible = False
15
3764
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. How do i hide a column? Thanks. MyConnection = New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes") MyCommand = New SqlDataAdapter("select * from Authors",
6
14696
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 using the Imagebutton.Attributes.Add("onMouseOver","this.src = 'somepicture.jpg') and that works fine. I've tried some java script to change the other control's visible property by changing is className, but that doesn't seem to work
4
2475
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 ItemDataBound event of the datagrid e.g. If e.Item.Cells(8).Text = "2" Then 'Make the textbox defined in my edititemtemplate read only of invisible End If
3
5953
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 with CListView, and New Window view class inherited with CFormView.
4
1945
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 parent form and this button is visible to me on inherited form. The problem is: I have written a click event of the button1 on both of the forms. tell me the way if i click the button on inherited form only parents' click event will be called and...
7
7022
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 (int i = datagridObject.Rows.Count - 1; i >= 0; i-- ) {
0
9325
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9152
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9571
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8569
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6410
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4996
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2542
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.