I have a dynamic picturebox created at run time that loads an image and I want this picturebox to be clickable and open a web page.

Here is the code that creates the picturebox in the formload section:-

void MainFormLoad(object sender, EventArgs e)
PictureBox pb = new PictureBox();

pb.Location = new Point(100, 100);

pb.Size = new Size(75, 75);

pb.BorderStyle = BorderStyle.Fixed3D;

pb.ImageLocation = "http://www.example.com/image.jpg";



I have looked at various examples of this on the net but could not get anything to work.

I have tried,

pb.Click += System.Diagnostics.Process.Start("http://www.example.com");

but just get an error.


MT ;)

This question has already been answered. Start a new discussion instead.