FileNotFoundException on embedded Resources?

D

Dominik Amon

Hi

When i'm adding an Image to a picturebox as an embedded resource i always
get a file not found exception:

Splash.cs:
namespace PocketCAlc
{

.....

public class Splash : System.Windows.Forms.Form
{



private void InitializeComponent()
{

....
this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Size = new System.Drawing.Size(240, 312); <---Here it
happens
....
}
}
}



here is an excerpt from the Splash.cs.resx
==============================

<?xml version="1.0" encoding="utf-8"?>
<root>

<xsd:schema id="root" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0"
msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0"
msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"
msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string"
msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string"
msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0"
msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Windows.Forms.Design.CFResXResourceReader,
System.CF.Design, Version=7.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a</value>
</resheader>
<resheader name="writer">
<value>System.Windows.Forms.Design.CFResXResourceWriter,
System.CF.Design, Version=7.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a</value>
</resheader>
<data name="pictureBox1.Locked" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="pictureBox1.Modifiers" type="System.CodeDom.MemberAttributes,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="pictureBox1.DefaultModifiers"
type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="pictureBox1.Image" type="System.Drawing.Bitmap,
System.CF.Drawing, Version=7.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
*********** BASE 64 ENCOEDED FILE
CUTTED FOR SMALLER POSTING ;-)

******
</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.CF.Drawing,
Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.Name">
<value>Splash</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
</root>

==============================

So the file is in the RESX.
The DefaultNameSpace is PocketCAlc the whole app.

Note: i see the image in Visal Studio

What's wrong?

--

Mit freundlichen Gruessen,

Dominik Amon
www.amon.cc
 

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