I'm not quite sure what you are trying to do that is giving you a problem.
If you do this:
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(ofd.FileName);
}
It works. If you specify the path to the image directly, it works.
pictureBox1.Image = new Bitmap(@"\My Documents\My Pictures\Flower.jpg");
So what am I missing?
"From local system folder i want take an image and i want to place it as header of that app. will it work?"
Yes. All you have to do is provide the path:
pictureBox1.Image = new Bitmap(@"\Windows\Flower.jpg");
Or are you trying to take it from your PC? Because if so, that won't work when you move out of the emulator and into the real thing...
"its giving same "file not found error".Image is in images folder of the project.I think Before this the image need to copy to the emulator?..if so, how to copy that image to emulator..can you tell?"
1) In your project open the Images folder in Solution Explorer.
2) Highlight the image you want.
3) In the properties pane, set:
3a) Build Action: Content
3b) Copy to Output Directory: Copy If Newer
Then in your code:
string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
pictureBox1.Image = new Bitmap(path + @"\Images\MyImageFile.jpg");