Help

  • Thread starter Thread starter Carmine
  • Start date Start date
C

Carmine

Hi NG,
I need your help to solve this problem:
In a form I have located a blank pictureBox. I don't know before some
events which image I need to show in the picturebox and at the same
time I don't know the list of the images...but I know only the url of
the images! Now, Is it possible to show in the picturebox images using
the url?

thanks in advance
 
Carmine,

You should be able to do this. What you want to do is get a class that
derives from WebRequest using the static CreateMethod on the WebRequest
class. With the request, you can call the GetResponse method, and get a
class that derives from WebResponse. Once you have that, you can call the
GetResponseStream method to get a Stream that has the image data (assuming
that the image is what is being passed to you and not a page with the image
in it). Finally, call the static FromStream method on the Image class,
passing in the Stream that is returned from the call to GetResponseStream,
and then set the PictureBox's Image property to the Image that is returned.

Hope this helps.
 
Back
Top