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..
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"
www.amrosama.com | the unholy methods of javascriptCode:eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
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:
[highlight=csharp]private void webBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
}[/highlight]
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:
[highlight=csharp]private void webBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
progressBar.Maximum = Convert.ToInt32(e.MaximumProgress);
progressBar.Value = Convert.ToInt32(e.CurrentProgress);
}[/highlight]
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.
-Martin
its working perfectly
thank you whoiga very much, i really appreciate it
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"
www.amrosama.com | the unholy methods of javascriptCode:eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
No problem. Cheers.
-Martin
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)![]()
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks