I am trying to hide a property from Intellisense for the Text property of the TextBox control.
I tried the following, but I get a compile error complaining that the Text property is not set as virtual in the base class. I am not trying to remove the property, just hide it from Intellisense. Any ideas?
public class MyTextBox:TextBox
{
[EditorBrowsable(EditorBrowsableState.Never)]
[Browsable(false)]
public override string Text
{开发者_StackOverflow
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
}
YOu can use new keyword to hide it if its not virtual.
Like this:
public class MyTextBox:TextBox
{
[EditorBrowsable(EditorBrowsableState.Never)]
[Browsable(false)]
public new string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
}
加载中,请稍侯......
精彩评论