How do I view an image hosted in my App?

Asked

Viewed 89 times

0

I would like to display a promotional image within a PicutreBox in my app, but this image will vary according to the promotion that the Company will make.

Is there any code that PictureBox show a certain image that is hosted somewhere?

Something similar to HTML, when we need to pull an image from a Host or FTP, we use:

src="img/logobranco.png"

Any code in C# that does the same function?

  • Windows Forms? WPF? Web Forms? ASP.NET MVC? Nancy? C# is "only" the programming language...

  • I’m using Windows Forms.

  • You want to use a web image to put on PictureBox?

  • @jbueno Fetched on the Web or Fetched from a database, ftp..

  • 1

    Each case is a different case. Basically, having the address of the image (as long as it is public) is just putting the path in the property I mentioned below. Or else, as long as you have an object Image just set the property Image of PictureBox. If your doubt is just like "instantiating a Image" from these sources, better open a specific question explaining this. Plus, you’ll need a question for each type (FTP, HTTP, Database, file system local, etc..).

1 answer

4


Just define the property ImageLocation of PictureBox with the image address.

Ex.:

pictureBox1.ImageLocation = "https://www.site.com/images-winforms/promocao-principal.jpg";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.