Connecting Tech Pros Worldwide Forums | Help | Site Map

Design-time property error

scpedicini@yahoo.com
Guest
 
Posts: n/a
#1: Nov 17 '05
Okay,

I've been having a problem with custom design-time properties that has
been driving me nuts for about a week. The control that I'm working on
extends System.Windows.Forms.AxHost, but I'm unable to add any custom
properties to the control.

Eg,

private string stringProp = null;
public string StringProp
{
get
{
return stringProp;
}

set
{
stringProp = value;
}

}

For the attributes, I've tried about or/and combinations the following:

[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Visible)]

Every time, the result is the same. I bring up another project, add the
control to the toolbox, then place the control down on the form. All
the properties inherited from AxHost work properly. My properties are
visible, but don't work. I can see the property StringProp, but it is
greyed out, and the editable field is solid black. Any attempts to
click on the property field to edit it result in a
NullReferenceException window being thrown. Just for the heck of it, I
attached the debugger to Visual studio itself, but breaking just shows
assembly lang.

I'm at my wits end. Why would a instance even be required in the first
place? My knowledge of how the design time property window worked is
that filling in a value would result in a line of code being added to
the InitializeComponent() method setting the property to some value.
The valid properties are all aggregated and placed in the designer
window via reflection I would assume. Obviously, the property isn't run
until the control is instantiated. Anyways, this is just speculation on
my part.

Does anybody have any insights into this? I've tried everything I can
think of, and nothing works. By putting a Debug.WriteLine statement in
the get { } / set { } routines of StringProp, I was able to see that
the get function is being run when I scroll through the properties in
the design-time window. However, any attempts to edit the field(which
is empty and solid black), result in a NullReferenceException. The set
part of the property never gets run.

Help help I'm so confused,
Shaun


Closed Thread