System.Windows.Forms.PictureBox.LoadAsync Method

Loads the image at the specified location, asynchronously.

Syntax

public void LoadAsync (string url)

Parameters

url
The path for the image to display in the System.Windows.Forms.PictureBox.

Remarks

If the url parameter indicates a local file, the recommended format is a local file path. For example, an image file named myPicture.jpg located at c:\ 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 PictureBox.Load(string) method sets the PictureBox.ImageLocation property to the value of url.

A call to the PictureBox.LoadAsync(string) method sets the PictureBox.ImageLocation property to the value of url. Besides calling the PictureBox.LoadAsync method, you must set the PictureBox.WaitOnLoad property to false to load an image asynchronously. When you load an image asynchronously, you can handle the PictureBox.LoadProgressChanged event to determine the progress of an image load or the PictureBox.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 System.ComponentModel.AsyncCompletedEventArgs.Error property of the System.ComponentModel.AsyncCompletedEventArgs.

Requirements

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