When you add a label to the form from the toolbox, its text defaults to the item's name (label1
, label2
, etc). How can I make this happen with a custom control? So far, I have the following, which allows me to change the text through the property window:
private string _text;
[BrowsableAttribute(true)]
public override string Text
{
get { return _text; }
set
{
_text = value;
lblID.Text = _text;
}
}
Apparently the above code works as is, but I'm not sure why. Does Text
default to the object's name automatically? The question still stands for other properties which don't override Text
.