开发者

provide properties in design time by custom controls (.NET)

I create some control and i define some properties who can define in desing time, but only shows one. Another issue is t开发者_开发百科hat in the one shown, the textbox of the form was displayed, but i can't select any.

    [Description("Blah Blah Blah"),
    Category("Data"),            
    DefaultValueAttribute(typeof(TextBox), null),
    Browsable(true)]
    //Only show this one
    public TextBox textBox
    {
        set { txt = value;}
    }


    [Description("Blah blah blah again"),
    Category("Data"),
    DefaultValueAttribute(typeof(string), null),
    Browsable(true)]
    public string Mensaje
    {
        set { sMensaje = value; }
    }

so, what's wrong with my code


Your properties are missing getters.

// Snip attributes
public TextBox textBox
{
    get { return txt; }
    set { txt = value;}
}

// Snip attributes
public string Mensaje
{
    get { return sMensaje; }
    set { sMensaje = value; }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜