Load an image from a url into a PictureBox

1. Run Visual Studio

2. File> New project, select ‘C# windows Form Application’ and give it a name.

3. On the right column select Form1.cs, on the left open the toolbox, drag and drop over the Form:
– Button
– PictureBox

4. On the right column in the Property Window under the ‘Design’ section (Progettazione) change (Name):
– Button -> button1
– PictureBox -> pictureBox1

5. Double-click the button to create the button1_Click event handler, and add the following code in Form1.cs


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test_ImageStream
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string url = "http://www.lucedigitale.com/principale/images/logo.png";

            {
                pictureBox1.Load(url);
            }
        }
    }
}

6. Run