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.