Picturebox problem

  • Thread starter Thread starter Christian Papauschek
  • Start date Start date
C

Christian Papauschek

I just created a new project and a picturebox on Form1. If
I use the PictureBox without a Picture everything works
fine. But when I load a picture, I get the following Error
on my x86-Device:

Exception: RuntimeConstructorInfo::Invoke+0x6a
RuntimeConstructorInfo::Invoke+0x6a
ConstructorInfo::Invoke+0xa
ResourceReader::CreateResource+0x18
ResourceReader::LoadBitmap+0xb9
ResourceReader::LoadObject+0x20b
RuntimeResourceSet::GetObject+0x74
ResourceManager::GetObject+0x3b
ResourceManager::GetObject+0x8
Form1::InitializeComponent+0x2c
Form1::.ctor+0x1f
Form1::Main+0x5


Has anyone an idea how to fix this problem?
Thanks for help!
 
Can you please post the code you used to assign the image to the
PictureBox...

What exact device is this on?

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
Handheld Interactive Reference Guides
 
This is typically caused by improperly referencing the resource.
First make sure that the resource has Build option set to Embedded Resource
and not Content
Then it is usually helpful to enumerate the resource names using something
like:

foreach(string sRes in
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames()
)
{
MessageBox.Show(s);
}
 
First I want to thank you all because it is really important for me to
display pictures.


@Peter Foot: I use Visual Basic .NET 2003 for development and therefore
i need no code to display a picture. I simply drop the picturebox on my
form and then i choose a picturefile for it.
visual basic creates automatically the following code:

Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(Form1))
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"),
System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(176, 168)
Me.PictureBox1.Size = New System.Drawing.Size(104, 56)

I'm working with a Kontron MOPSlcdGX1
Specifications:
http://www.jumptec.de/product/data/pc104/mopslcdgx1_e.html



@Alex Feinman: How do I do this? The application works perfectly on the
Windows CE Emulator and on Windows XP. But I use my own generated
Platform on my device (Platform Builder 4.1). Three days ago
PictureBoxes worked well, they displayed my pictures and everything was
fine, but since yesterday they don't work anymore. (I don't think that
I've changed anything, but something must have happened?)

@stuart Mahoney: What is a default namespace and how do i set it?

Thanks!
 
This line...

Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"),
System.Drawing.Image)

...seems to be responsible for loading the picture. as i said before it
worked everywhere (WinXP, WinCE Emulator, Device) but since yesterday it
didn't work anymore on my device! (but it works still on WinXP and on
the Emulator)

If I remove this line no error appears on my device, but of course no
picture is displayed...
 
Back
Top