Einar,
If you have embedded resources you can use the ResourceManager class in the System.Resources namespace. There are lots of examples available but the following code shows you how to create a custom resource file and read from it (an image and a string).
private void button1_Click(object sender, System.EventArgs e)
{
ResourceWriter imageResource = new ResourceWriter("quotes.resources");
Image testImage = Image.FromFile(@"c:\test.bmp");
imageResource.AddResource("msg1", "This is a string");
imageResource.AddResource("neil", testImage);
imageResource.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
ResourceManager imageResManager = new ResourceManager("WindowsApplication1.quotes", Assembly.GetExecutingAssembly());
pictureBox1.Image = (Image)imageResManager.GetObject("neil");
MessageBox.Show((string)imageResManager.GetObject("msg1"));
}
Three things to note.
1] The button1_Click event generates the resource file, you need to add this to your project and rebuild it with the Build Action as Embedded Resource.
2] You prefix the name of the resource with the Namespace otherwise you will get exceptions.
3] If you are using cultures then you will have to supply culture specific resources and use the overloaded GetObject passing in the correct culture.
Regards
Neil