a b

a b

  • NA
  • 3
  • 0

System.Drawing.Image.FromFile()

Apr 28 2007 10:08 AM
Hi guys, Im relatively new to C# and I was wondering if ye could help me out with this problem. Its absolutely doing my nut in. Im trying to display a jpeg in my pictureBox1 which is stored locally on my machine. Im using: pictureBox1.Image = System.Drawing.Image.FromFile(@"blah blah blah"); or I also tried Image img = Image.FromFile(@" ... "); but everytime I keep getting the error to the effect " System.Drawing.Image does not contain a definition for 'FromFile' ". I cant understand it. Every program iv searched on the net uses this but my program wont allow me. What do I need to do to allow it to work? Currently Image. only gives me 3 options, .Equals, .FromHbitmap, and .ReferenceEquals. What can I do to solve this error or am I going the wrong way about displaying the file altogether?? I also tried, Bitmap b = new Bitmap(directory + @"Point1.jpg"); which worked but threw an exception whilst debugging saying it cant find part of the file or directory. Any help would be MUCH appreciated. Im really tied for time here. Cheers!

Answers (3)