PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework VS 2005 Designer issue

Reply

VS 2005 Designer issue

 
Thread Tools Rate Thread
Old 16-01-2006, 05:52 PM   #1
dantheman
Guest
 
Posts: n/a
Default VS 2005 Designer issue


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

  Reply With Quote
Old 16-01-2006, 06:43 PM   #2
Tim Wilson
Guest
 
Posts: n/a
Default Re: VS 2005 Designer issue

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
>



  Reply With Quote
Old 16-01-2006, 06:55 PM   #3
dantheman
Guest
 
Posts: n/a
Default Re: VS 2005 Designer issue

yep that was the problem

thanks Tim

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off