Link to home
Start Free TrialLog in
Avatar of jamesellis_2001
jamesellis_2001

asked on

Adding Progress bar to a browser

Hi

Im in the process of making an internet browser.  And i would like to know how i could add a progress bar to show the percentage completion of a webpage loading.  Could you help me please??

Thanks
Avatar of AzraSound
AzraSound
Flag of United States of America image

The webbrowser has an event called ProgressChange that gives you the current Progress, and the maximum progress.  Add a progress bar with a min of 0 and a max of 100 and add something like this:


Private Sub WebBrowser_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)

    If Progress = -1 Then
        ProgressBar.Value = 100
    Else
        ProgressBar.Value = (Progress/ProgressMax) * 100
    End If
End Sub
Avatar of SirCaleb
SirCaleb

Go to Project > Components and scroll down and find Microsoft Windows Common Controls 6.0 (SP3)

Select the checkbox and you will now see a "ProgressBar" icon on the toolbox menu.  Just paint this onto your window/form and you're ready to roll!

It's fairly easy to use, you set the min & max value and then just increment the value as you step through your loop(s).

Avatar of jamesellis_2001

ASKER

thanks AzraSound, although i paste the code into my project.  And changed the names of the objects.  Although when i run the program it comes up with 'overflow'?!?!
I altered the code slightly although When the webpage load is complete A caption comes up saying "overflow"
I altered the code slightly although When the webpage load is complete A caption comes up saying "overflow"
You're probably getting an overflow because the max value of the ProgressBar might be 100.  Try doing some division so your max never exceeds 100.
And also, you need to define the .max and .min property to whatever the max and min value is going to be.  By default, they are zero or one.
ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial