Jump to content

Image.FromStream - What am I missing here.


Recommended Posts

Posted

I'm working on a function to load a PictureBox from a URL that points to an image.

private void GetImage(string URL, PictureBox picSource)

{

            Image WebImage = null;


            // prepare the web page we will be asking for

            HttpWebRequest  request  = (HttpWebRequest) WebRequest.Create(URL);


            // execute the request

            HttpWebResponse response = (HttpWebResponse) request.GetResponse();


            // we will read data via the response stream

            Stream stream = response.GetResponseStream();

            WebImage = Image.FromStream(stream);

            stream.Close();


            if (WebImage != null) { picSource.Image = WebImage; }

}
I get this error when I compile.
Error	1	'System.Drawing.Image' does not contain a definition for 'FromStream'

Any help would be greatly appreciated. ;)

  • 2 weeks later...
Guest simongardner
Posted

If its any help, your code compiles fine with me. I'm using Visual Studio .NET 2003 Professional. My problem is getting an image to place in a picturebox for a windows application. I get an error when I runtime error like this:

'URI formats are not supported'.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.