This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| GOG |
| GOOD ANSWER |
I've trying to code a faily simple UserControl object and have run into a problem that I can't get around. I want my control to surface a "Text" property that can be used at both design and run time.
Here is the current code for that property: [Browsable(true)] public override string Text { get { return checkBox1.Text; } set { checkBox1.Text = value; } }
This "half-works". Using a test form, I can place my control and change the Text property via the designer, but the code to actually set the Text property is never written into the "InitializeComponent()" method of the form. If I change the name of the property to "TextXX" (and remove the override) it works as expected.
Do you know why this might be happening? If not can you suggest a debugging strategy to determine what is going on? Do you know of any texts/articles/cookbooks on building non-trival user controls?
Thanks All, GOG
|
|
|
| |
|
|
| |
| |
| Stoitcho Goutsev \(100\) [C# MVP] (VIP) |
| GOOD ANSWER |
Hi GOG,
This is the way you should define your property
[Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public override string Text { get { return checkBox1.Text; } set { checkBox1.Text = value; } }
-- HTH B\rgds 100 [C# MVP]
"GOG" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... > I've trying to code a faily simple UserControl object and have run into a problem that I can't get around. I want my control to surface a "Text" property that can be used at both design and run time. [Original message clipped]
property is never written into the "InitializeComponent()" method of the form. If I change the name of the property to "TextXX" (and remove the override) it works as expected. [Original message clipped]
|
|
|
| |
|
|
| |
| |
| GOG |
| GOOD ANSWER |
Fantastic!!!! Thank you
I've been trying to figure that out for a while. I figured that there was an attribute for it, but couldn't even find a list of attributes to search through. Do you know of a good "attribute reference"? (I figure it's in MSDN somewhere, but I have been able to tease it out yet, likely something simply i've missed).
Thanks again, GOG
|
|
|
| |
|
|
| |
|
| | |
|
|
|
|
|