Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

how to make a progress bar fro web browser control??


  • Please log in to reply
4 replies to this topic

#1 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 30 July 2008 - 11:03 PM

hi all,
im new to c# and im working on simple lyrics finder aplication that opens a site with a song lyrics in a web browser....
and i wanted to make a progress bar for it but i dont know how..
  • 0
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#2 whoiga

whoiga

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 01 August 2008 - 10:03 PM

The easiest method in my opinion is to add a StatusStrip control to your form. This will allow you to do a multitude of status-related tasks and display the results of such in the status strip. Or, if you wanted to keep things simple, you could just add "only" a ProgressBar control to your form. I'll run you through doing it with the StatusStrip control.

Assuming you already have a WebBrowser control on your form, named webBrowser, add a StatusStrip control to your form.

Once the StatusStrip is in place and you have it selected, you will see a little tool icon with a drop-down arrow. Click on this, and select "ProgressBar" - this will add a ProgressBar control to the status strip. Let's assume you name it progressBar.

Select your WebBrowser control and then view the Events in the Properties pane. Locate the ProgressChanged event and double-click it. This adds a new method to your form's .cs file that looks something like below:

private void webBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{

}


This method will be called on every occurrence of the ProgressChanged event.

Inside the method, we'll do two things: 1) Set the maximum, 2) Set the value.

To do that, modify your method so it looks like this:

private void webBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
progressBar.Maximum = Convert.ToInt32(e.MaximumProgress);
progressBar.Value = Convert.ToInt32(e.CurrentProgress);
}


The reason we convert the e.MaximumProgress & e.CurrentProgress values to int 32s is that they are longs, and the properties of the ProgressBar control must be set using integers, not longs.

I hope this helps. Please respond if you encounter further trouble or if this helps you along your way.
  • 0

#3 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 02 August 2008 - 04:12 AM

its working perfectly:D
thank you whoiga very much, i really appreciate it
  • 0
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#4 whoiga

whoiga

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 02 August 2008 - 09:59 AM

No problem. Cheers.
  • 0

#5 eliasmaq

eliasmaq

    CC Lurker

  • Just Joined
  • Pip
  • 9 posts

Posted 15 June 2010 - 05:53 PM

THANKS!!!!!! i was making other simple thing, a web browser, and i was looking for this for a long time ago. im also happy to know there are more people that use c#
(im new in the forum):)
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download