Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to make a property not show up in propertyGrid
 

How to make a property not show up in propertyGrid

I have a control that derives from the TextBox control. It has some additional properties in addition to the ones inherited from the TextBox control.

I know that for all public properties, the default value for the browseable attribute is true which means that when you drag a control on to a form, the property will show up in the propertyGrid.

My question is how do I turn the browseable attribute to false since I don't want all the properties in my control to show up in the propertygrid.

I will explicitly set the browseable property to true for those properties that I want to show up in the propertygrid.

Anyhelp in this regard is greatly appreciated.

jbourne  Wednesday, March 29, 2006 5:22 AM
You have to add the BrowsableAttribute attribute to your property, and it is set to false, to tell the property browser that the property in non-browsable.




public class MyTextBox : TextBox
{

[Browsable(false)]
public bool NonBrowsableProperty
{
get
{
return true;
}
}

}





Regards,

-chris
Chris Vega  Wednesday, March 29, 2006 6:23 AM
You have to add the BrowsableAttribute attribute to your property, and it is set to false, to tell the property browser that the property in non-browsable.




public class MyTextBox : TextBox
{

[Browsable(false)]
public bool NonBrowsableProperty
{
get
{
return true;
}
}

}





Regards,

-chris
Chris Vega  Wednesday, March 29, 2006 6:23 AM

You can use google to search for other answers

Custom Search

More Threads

• textbox.validating fires AFTER button.click event
• Bulk Update in .NET
• help me please. How can i disable a listview item?
• how to open instance of Ms Project
• Control.FromHandle is returning nulls
• TabControl Tab order wrong ?
• VS 2005 crashes when adding a typeconverter for a custom struct
• AxMSFlexGrid activeX control
• Problem with Form Display
• looking for some direction - visual studio 05 and mysql