How can I override the default Text when extending a toolbar in VS 2003 version?

I wanted to extend the toolbarbuttons with mytoolbarbutton.

How can I override the default Text when extending a toolbar in VS 2003 version

Here is the sample I wrote (I know this is very awkward workaround) and wanted to make it proper.

public __gc class MyToolBarButton : public ToolBarButton
{
private: String* _title;
public: MyToolBarButton() : ToolBarButton()
{
...
}

__property String* get_Title()
{
return this->_title;
}
__property void set_Title(String* value)
{
this->_title = value;
this->Text = this->_title;
}
}

Instead of get_Title and set_Title, I want to use get_Text and set_Text (or whatever way to override the default text property) like this.

public __gc class MyToolBarButton : public ToolBarButton
{
private: String* _text;
public: MyToolBarButton() : ToolBarButton()
{
...
}

__property String* get_Text()
{
return this->_text;
}
__property void set_Text(String* value)
{
this->_text = value;
}
}

I am missing something here. Can you please guide me


Thanks in advance,




Answer this question

How can I override the default Text when extending a toolbar in VS 2003 version?

  • jonesbrasil

    Experts,

    Please help. I do not know how to override the default function when I extend the objects.

    VB or c# or C++ examples are fine.

    Thanks,



  • Kyndig

    hi Jil

    I tested a simple sample on VS2003 in C#. It works fine.

    public class MyToolBarButton : System.Windows.Forms.ToolBarButton
    {
    private string val;
    public MyToolBarButton()
    {
    }
    public new string Text
    {
    get
    {
    return val;
    }
    set
    {
    val = value;
    }

    }
    }

    hope this can help you



  • Declan_

    gqlu,Great. Thanks a lot.

  • How can I override the default Text when extending a toolbar in VS 2003 version?