Monday, August 15, 2005

Error loading image in picturebox

I got a most peculiar error last week when running a C# Windows forms project. This project contained a windows form with a picturebox for which I changed the image property to a specific image file. The error was triggered by this line this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); and said
"Additional information: Could not find any resources appropriate for the specified culture ( or the netrual culture ) in the given assembly. Make sure PortalCreator.resources was correctly embedded or linked in to thassembly Dolmen.SharePoint.Tools.PortalCreator"

The problem seemed to be caused because I defined an enum in the code file before the PortalCreator class. This caused the wizard generated code in InitializeComponent() to fail. So always make the form class the first class in the file.

[Listening to: Kinderfeld - Marilyn Manson - Antichrist Superstar (04:54)]

No comments:

Post a Comment