Guest idolpx Posted December 31, 2005 Report Posted December 31, 2005 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. ;)
Guest simongardner Posted January 12, 2006 Report Posted January 12, 2006 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'.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now