Windows Develop Bookmark and Share   
 index > Windows Forms General > Reintroducing the Text as designable to a UserControl
 

Reintroducing the Text as designable to a UserControl

I have a user control, and by default the Text Property isnt visible in the designer. I'd like it to be.

So I override the property thus:

public override string Text

{

get

{

return base.Text;

}

set

{

base.Text = value;

}

}

and decided to make it Browsable(true)

Which works great - its there and visible in the designer. However, while I can now see the text property and can edit it, the changes do not persist - ie i add some text, and then hit F6 to build and the Text gets reset to empty. Is there something obvious I'm missing here?

Thanks for the help and Happy New year!

thedo  Friday, January 04, 2008 12:28 PM
Adding

[Browsable(true)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

Seemed to do the trick.

Neil

thedo  Friday, January 04, 2008 2:15 PM
Adding

[Browsable(true)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

Seemed to do the trick.

Neil

thedo  Friday, January 04, 2008 2:15 PM

You can use google to search for other answers

Custom Search

More Threads

• How to create beautiful UI base on Form
• using CMD.exe in form
• How to create a Wizard with Windows Forms?
• Block the process father when the process son is blocked
• Faders, Knobs , Dials, Buttons for visual studio 2008
• Checking for a null entry in a textbox
• ListView change view type problem
• Event for a line
• How can i detect, that the WebBrowser Control send an AJAX Request
• Create dynamically different windows forms