D
DS
I'm trying to create a user control in which I have a textbox , and I want
to be able to set the default value at design time in the Winforms designer,
but I'm running into a bit of a problem. The only items on the control is a
textbox and a listbox. First, here's the code:
[Description("Gets or sets the text contained in the control."),
Category("Appearance"),
Browsable(true)]
public override string Text
{
get
{ return txtQuery.Text; }
set
{ txtQuery.Text = value; }
}
If I have it like this, any forms that I've added to the control already
behave properly. If I try to add the control to a form though, I get this
cryptic error from VS.Net:
"Count cannot be less than zero. Parameter name: count"
No luck googling it either. Strangely though, if I remove the browsable
attribute, or rename the property to something like 'texta' then it works
just right. Problem with removing the browsable attribute is that then it
isn't displayed in the properties pane; if I name it 'texta', then its not
very consistant with the reast of the framework.
What am I doing wrong here, or have I had the pleasure of finding yet
another "undocumented feature"? Is there a way to make this work, or should
I just name it something else and be done with it?
Thanks
-Dan
to be able to set the default value at design time in the Winforms designer,
but I'm running into a bit of a problem. The only items on the control is a
textbox and a listbox. First, here's the code:
[Description("Gets or sets the text contained in the control."),
Category("Appearance"),
Browsable(true)]
public override string Text
{
get
{ return txtQuery.Text; }
set
{ txtQuery.Text = value; }
}
If I have it like this, any forms that I've added to the control already
behave properly. If I try to add the control to a form though, I get this
cryptic error from VS.Net:
"Count cannot be less than zero. Parameter name: count"
No luck googling it either. Strangely though, if I remove the browsable
attribute, or rename the property to something like 'texta' then it works
just right. Problem with removing the browsable attribute is that then it
isn't displayed in the properties pane; if I name it 'texta', then its not
very consistant with the reast of the framework.
What am I doing wrong here, or have I had the pleasure of finding yet
another "undocumented feature"? Is there a way to make this work, or should
I just name it something else and be done with it?
Thanks
-Dan