Skip to content

Display image from local disk c

Eva H

Asked Jun 4, 2012, 10:52 AM EDT2 answers
Share
LinkedInX
Hi,

I have a problem.
I can't display image if it is stored on local disk c. The image class displays images only if there are in the project.

For an example this will display the image :

Image1.ImgUrl = @"~\image.jpg"

But this won't display anything:
Image1.ImgUrl = @"C:\images\image.jpg";

Does anyone have an idea how to display an image in this situation?

Can someone please help, I don't know what to do anymore...

Thanks

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi Eva

    if you are getting photo in picturebox then
    try it
    if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    pictureBox1.Load(openFileDialog1.FileName);
                    textBox1.Visible = true;
                    textBox1.Text = string.Format("{0}", openFileDialog1.FileName);
                    
         }
    TEXTBOX will show you  your photo path..
    0
  • 0
    I'm not using a picture box. I'm using a Image Control because there are no picture boxes in Web forms
    0