Set the UserControl property to display in the VS properties window

I have a UserControl in my Asp.net project that has a public property. I do not want this property to appear in the Visual Studio properties window when a user selects a UserControl instance in the IDE. What attribute (or other method) to use to prevent its occurrence?

class MyControl : System.Web.UI.UserControl { // Attribute to prevent property from showing in VS Property Window? public bool SampleProperty { get; set; } // other stuff } 
+6
c # properties visual-studio attributes
source share
3 answers

Use the following attribute ...

 using System.ComponentModel; [Browsable(false)] public bool SampleProperty { get; set; } 

At VB.net this will be :

 <System.ComponentModel.Browsable(False)> 
+11
source share

Tons of attributes to control how the PropertyGrid works.

 [Browsable(false)] public bool HiddenProperty {get;set;} 
+3
source share

Use the System.ComponentModel.Browsable attribute to

 > ' VB > > <System.ComponentModel.Browsable(False)> 

or

 // C# [System.ComponentModel.Browsable(false)] 
+2
source share

All Articles