Click here to Skip to main content
Click here to Skip to main content

Tagged as

Load an Image from Internet to PictureBox control and Track the Loading Progress

, 5 Jan 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
How do you load an Image from the internet into a picture box control. How will you track the loading progress
Have a form with a Picture Box control, a Buttton to load the image and a Progress Bar control. Add a Label next to the progress bar to show the % loaded.
The code below loads the Image from internet:
//Image_003: Load the Image from the Internet
private void btnLoadInternet_Click(object sender, EventArgs e)
        if (radNormal.Checked == true)
            pict.WaitOnLoad = false;
        MessageBox.Show("Check that Internet Connection is available");
Now provide the handler for the LoadProgressChanged event of the Picture box control. Unlike load method, the LoadAsync will raise the LoadProgressChanged event when some amount of image bits are downloaded from the http path. Inside the handler, we will use the event argument to decide how much of image is loaded. And the progress bar value is set with the percentage of completion retrieved from the event argument. Also the label control shows the number of percentage.
//Progress_001: Increment the value of the progress bar to show the image
//Load progress
private void pict_LoadProgressChanged(object sender, ProgressChangedEventArgs e)
    progLoadStatus.Value = e.ProgressPercentage;
    lblProgress.Text = e.ProgressPercentage.ToString() + "%";


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sivaraman Dhamodharan
Software Developer iSOFT
India India
I am working as software engineer in iSOFT R&D. I have been come accross C++,MFC, .net technologies. I do like playing video games, reading books.


Comments and Discussions

Generallaveenadeeps, your vote reason and comment is contradicting ... Pinmembersirama20043-Jan-11 3:09 
GeneralReason for my vote of 1 nice Pinmemberlaveenadeeps28-Dec-10 18:03 
GeneralThanks Walt and Krish Pinmembersirama200428-Dec-10 1:53 
GeneralThanks! I wasn't aware of that particular event. PinsubeditorWalt Fair, Jr.27-Dec-10 14:24 
GeneralReason for my vote of 4 Nice event to know on Picture box. Pinmemberkrishnaraj4026-Dec-10 20:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150129.1 | Last Updated 5 Jan 2011
Article Copyright 2010 by Sivaraman Dhamodharan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid