PictureBox.ImageLocation Property

Definition

Gets or sets the path or URL for the image to display in the PictureBox.

C#
public string ImageLocation { get; set; }
C#
public string? ImageLocation { get; set; }

Property Value

The path or URL for the image to display in the PictureBox.

Remarks

The property value can be an actual path (for example, "C:\SomeFolder\SomeSubFolder\Picture.jpg"), a relative path ("\SomeSubFolder\Picture.jpg"), or a URL (http://contoso.com/images/Picture.jpg).

If a relative path is used, it will be considered relative to the working directory.

A call to the Load method will overwrite the ImageLocation property, setting ImageLocation to the URL value specified in the method call.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10