Hi All,

here it goes,

I have created a usercontrol "image button" and it all work fine except
for one strange thing, when i drag the control to a form "smart device
that is" and then save that form i get this error

Code generation for property 'Image' failed.
Error was: 'Object reference not set to an instance of an object.'

this only happends the first time i drag the control to a form and save
the form after that error if add more controls other then my image
button i save again it's ok

in the property designer the image property is set to (none)

now if in my constructor i had this line
this.image = new Bitmap(21, 21);
it all works ok

any idea y this is appening

Re: VS 2005 Designer issue by Tim

Tim
Mon Jan 16 12:43:09 CST 2006

Are you attempting to utilize the Image property, or the "image" field
behind the property, from anywhere within your custom control while it's
still "null"? In other words, have you gone through the source for your
control to ensure that no attempt is made to access the image object while
it is still set to "null".

--
Tim Wilson
.NET Compact Framework MVP

"dantheman" <daniel_st.pierre@fpl.com> wrote in message
news:1137433925.403299.170300@g14g2000cwa.googlegroups.com...
> Hi All,
>
> here it goes,
>
> I have created a usercontrol "image button" and it all work fine except
> for one strange thing, when i drag the control to a form "smart device
> that is" and then save that form i get this error
>
> Code generation for property 'Image' failed.
> Error was: 'Object reference not set to an instance of an object.'
>
> this only happends the first time i drag the control to a form and save
> the form after that error if add more controls other then my image
> button i save again it's ok
>
> in the property designer the image property is set to (none)
>
> now if in my constructor i had this line
> this.image = new Bitmap(21, 21);
> it all works ok
>
> any idea y this is appening
>



Re: VS 2005 Designer issue by dantheman

dantheman
Mon Jan 16 12:55:12 CST 2006

yep that was the problem

thanks Tim