Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a UserControl Property to Not Show Up in VS Properties Window

I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?

class MyControl : System.Web.UI.UserControl {
  // Attribute to prevent property from showing in VS Property Window?
  public bool SampleProperty { get; set; }

  // other stuff
}
like image 427
Yaakov Ellis Avatar asked Sep 16 '08 11:09

Yaakov Ellis


1 Answers

Use the following attribute ...

using System.ComponentModel;

[Browsable(false)]
public bool SampleProperty { get; set; }

In VB.net, this will be:

<System.ComponentModel.Browsable(False)>
like image 74
Phil Wright Avatar answered Sep 28 '22 19:09

Phil Wright