Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
LoadAsync Method (String)
Collapse the table of content
Expand the table of content

PictureBox.LoadAsync Method (String)

Loads the image at the specified location, asynchronously.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void LoadAsync(
	string url


Type: System.String

The path for the image to display in the PictureBox.

If the url parameter indicates a local file, the recommended format is a local file path. For example, an image file named myPicture.jpglocated atc:\ would be accessed by passing c:\myPicture.jpg for the url parameter. A full path, such as http://www.contoso.com/path/images/image.jpg, or a relative path, such as ./images/image.jpg, can be used. If a relative path is used, it will be considered relative to the working directory. A call to the Load method sets the ImageLocation property to the value of url.

A call to the LoadAsync method sets the ImageLocation property to the value of url. Besides calling the LoadAsync method, you must set the WaitOnLoad property to false to load an image asynchronously. When you load an image asynchronously, you can handle the LoadProgressChanged event to determine the progress of an image load or the LoadCompleted event to determine when an image load has completed. If an error occurs during an asynchronous image-loading operation, it will be caught and reported by the Error property of the AsyncCompletedEventArgs.

The following code example demonstrates how to use the LoadAsync method. To run this example, paste the following code into a Windows Form that contains a PictureBox named pictureBox1 and a Button named startLoadButton. Make sure that the Click event for the button is associated with the startLoadButton_Click method in this example. You must change the image file path to a path that is valid on your system.

private void startButton_Click(object sender, EventArgs e)
    // Ensure WaitOnLoad is false.
    pictureBox1.WaitOnLoad = false;

    // Load the image asynchronously.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft