Imports System.ComponentModel Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub loadBitmapButton_Click(sender As Object, e As EventArgs) Handles loadBitmapButton.Click cancelBtn.Enabled = True bitmapPictureBox.Image = Nothing 'This loads the bitmap asynchronously bitmapPictureBox.LoadAsync(bitmapLocationTextBox.Text) End Sub Private Sub cancelBtn_Click(sender As Object, e As EventArgs) Handles cancelBtn.Click 'Cancel the loading of the bitmap bitmapPictureBox.CancelAsync() End Sub Protected Overrides Sub OnLoad(ByVal e As EventArgs) MyBase.OnLoad(e) bitmapLocationTextBox.Text = Application.StartupPath + "\Sunset.jpg" End Sub Private Sub bitmapPictureBox_LoadCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles bitmapPictureBox.LoadCompleted cancelBtn.Enabled = False If (e.Error IsNot Nothing) Then 'An unexpected error occurred - display the details MessageBox.Show(e.Error.Message) ElseIf (e.Cancelled = True) Then 'The user cancelled the loading operation MessageBox.Show("Loading Cancelled") Else 'The loading was completed MessageBox.Show("Loading completed") End If End Sub Private Sub bitmapPictureBox_LoadProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs) Handles bitmapPictureBox.LoadProgressChanged 'Update the progress bar on the form loadProgressBar.Value = e.ProgressPercentage End Sub End Class