Yet More Bizarre Behavior -- Inconsistent Property Deserialization

M

Mark Olbert

Could someone please explain to me why InitializeComponent() code like the following:

//
// giver_rec
//
this.Controls.Add(this.dbFrameworkTextBox1);
this.Controls.Add(this.tbxAddress);
this.Controls.Add(this.tbxGiverName);
this.Name = "giver_rec";
this.SqlDataPackageType = typeof(Test.Component2);
this.TableName = "giver";

and properties defined as follows (for the class being initialized):

[
Category("SqlDataPackage"),
Editor(typeof(TableUIEditor), typeof(UITypeEditor)),
]
public string TableName
{
get { return tblName; }
set { tblName = value; }
}

[
Category("SqlDataPackage"),
Editor(typeof(SqlDataPackageUIEditor), typeof(UITypeEditor)),
]
public Type SqlDataPackageType
{
get { return dataPkgType; }
set { dataPkgType = value; }
}

Results in ONLY the SqlDataPackageType property being set when the component comes up in the
VSIDE???? I can watch SqlDataPackageType_set being called in the debugger, but the corresponding
TableName_set method NEVER gets called!

Does the component initialization process dislike strings or something????? :)

BTW, since Microsoft apparently firmly believes that custom component design shouldn't be
documented, does anyone have any 3rd party books they can recommend on Windows.Forms custom
control/component development?

- Mark
 
M

Mark Olbert

Followup -- I figured out what was causing the oddball behavior. It turns out I had an interface
definition on that class which included a TableName_get() method, but not a TableName_set() method.
I was updating the property (from within a UITypeEditor) using the interface, so there was no _set()
method.

Note to file:

public string TableName
{
get;
set;
}

and

string ISomeInterface.TableName
{
get;
}

are two totally different beasts.

- Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top