Text property in a UserControl in C#

Posted by yeyeyerman on Stack Overflow See other posts from Stack Overflow or by yeyeyerman
Published on 2010-05-21T10:55:51Z Indexed on 2010/05/21 11:00 UTC
Read the original article Hit count: 143

Filed under:
|
|

I have a control with a inner TextBox. I want to make a direct relationship between the Text property of the UserControl and the Text property of the TextBox. The first thing I realized is that Text was not being displayed in the Properties of the UserControl. Then I added the Browsable(true) attribute.

[Browsable(true)]
public override string Text
{
    get
    {
        return m_textBox.Text;
    }

    set
    {
        m_textBox.Text = value;
    }
}

Now, the text will be shown for a while, but then is deleted. This is because the information is not written within the xxxx.Designer.cs. How can this behviour be changed?

© Stack Overflow or respective owner

Related posts about c#

Related posts about usercontrols