NotSupportedException was unhandled on a Picturebox

R

robear

I getting the above error when I try to debug the application in a WM5
Phone Emulator. The referenced image is only 37KB in size. The
application has 3 labels two textboxes, one date picker, a combobox and
the picturebox.

This code is in the InitializeComponents region, so therefore has been
created by the designer when I added the PictureBox.

Here is the code:

//
// pictureBox1
//

this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
<----- Errors on this line

this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(234, 72);


I have seen some similar posts, but none deals with code that the
designer (VS2005) has created. This happens in both Debug and Release
deploys.

Of course this app is in C#, but the app has also been developed in
VB.NET and it doesn't have an issue...

Any help?

Thanks,
Robert
 
R

robear

Thanks or your reply..

I have tried it with 24bit JPG and 24bit BMP..

So are you saying that C# Picturebox cant handle a 24Bit image, where
VB.NET Picturebox can??? I mentioned in my post that it works fine in
VB.NET

Thanks again,
Robert
 
I

Ilya Tumanov [MS]

You should try loading this file without using resources. Resource handling
code is locale aware, so it would go extra mile to create Culture object for
current locale.

In some case this is not supported by the OS.



Few notes:

- Always post stack trace, that would help identify the problem.

- Image of "only 37 kb" can take out entire device memory once
unpacked.

--
Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

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