Component vs IDE

  • Thread starter Thread starter Bram Vandendriesschen
  • Start date Start date
B

Bram Vandendriesschen

Hi,
I already found the solution to my problem, but I would
like to discuss it with you.
I developed a component with a property called Name (of
type String). Everytime I dropped the component on a form
the IDE complained with the well-known (and sometimes
nasty) "object reference not set to an instance ..."
message. The designer always set Name to null (which is
normal when you don't use DefaultValue). When I manually
delete this line, the problem stopped. Seems like this
statement sets some other (hidden) Name property to null
(previously set by the designer) instead of my own
property. I renamed the property and now everything is
fine (don't want to remove the line everytime).

Anybody a clue ?
And of course, sorry if this question has already asked.

Bram.
 
Bram,

It probably has something to do with the fact that a Name property is
provided which has the name of the variable which holds the reference. I
think that the IDE creates derived types and when it sees the Name property,
it clashes, causing your error.

That's only a guess.

Hope this helps.
 
Entirely true. Maybe it works the same way as a Tooltip
(implements IExtenderProvider). It also adds (visually)
one extra property to the fellow components on a form.
But then again, we might never really know.
Bram,
Thx.
-----Original Message-----
Bram,

It probably has something to do with the fact that a Name property is
provided which has the name of the variable which holds the reference. I
think that the IDE creates derived types and when it sees the Name property,
it clashes, causing your error.

That's only a guess.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,
I already found the solution to my problem, but I would
like to discuss it with you.
I developed a component with a property called Name (of
type String). Everytime I dropped the component on a form
the IDE complained with the well-known (and sometimes
nasty) "object reference not set to an instance ..."
message. The designer always set Name to null (which is
normal when you don't use DefaultValue). When I manually
delete this line, the problem stopped. Seems like this
statement sets some other (hidden) Name property to null
(previously set by the designer) instead of my own
property. I renamed the property and now everything is
fine (don't want to remove the line everytime).

Anybody a clue ?
And of course, sorry if this question has already asked.

Bram.


.
 
Back
Top