locked
Progress Bar & Status Label Problems RRS feed

  • Question

  • I am working on a web browser and have reached the step of inserting a progress bar and status text. I have a status strip at the bottom but when i insert a Progress Bar and I run the Program, it never works. For the status text I need to know what code is needed for there too. Could somebody tell me what code I need to insert into it so it will function properly. Also, will the Progress Bar disappear when I'm not loading a page then?

    Thanks

    Code Samples Below:

    Progress Bar Code:

    Private Sub ToolStripProgressBar1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripProgressBar1.Click

    End Sub

    End Class

    Status Text Code:

    Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel1.Click

    End Sub

    Tuesday, January 17, 2006 9:27 PM

Answers

  • Sorry if I was unclear... Hopefully this will be a bit better.

    On the ProgressBar what you need to replace "int" with is an integer value that expresses the percentage of work that you're representing that has been completed.

    Let's say that I have 100 of some object to process and I want to update the ProgressBar each time I complete processing one of my objects, I would do something like this:

    For i = 1 to 100 Step 1 
        // Process some object...
        call ProcessMyObject()

        // Increment the ProgressBar's value each time an object is processed.
        myProgressBar.Increment(1);
    Next

    As for the StatusText you're going to have to tell it what you want it to say. I don't believe that there is any automatic way of doing what you're appearing to want it to do. If you want the StatusLabel to say "Loading" you have to do

    myStatusLabel.Text = "Loading"

    If you want it to say "Opening Page", You have to do:

    myStatusLabel.Text = "Opening Page..."

    Basically depending on where you are in your code, and what you're doing you will need to update your StatusLabel's Text property along with the ProgressBar. You need to know how much work you've done, and how much total work needs to be done so you can show how much has been completed. This could involved getting the page's size and then showing the user how much has been downloaded so far, etc etc.

     

    Wednesday, January 18, 2006 2:27 AM

All replies

  • Cory,

    You've got to tell the ProgressBar when to change it's value. You can do this with the

    ProgressBar.Increment(int)

    ... method or the

    ProgressBar.Value(int)

    ...method. Either way, the ProgressBar does not magically move unless you set it's Style to Marquee, but even then you have to change it's value.

    On the StatusLabel you just have to set the Text property:

    StatusLabel.Text = "Some Text That I Wanna Display!";

    Tuesday, January 17, 2006 9:33 PM
  • I'm new to this so I'm still discovering what to do. What do I need to replace the "(int)" with because the build always fails. Could you please just edit the source codes posted above so I can understand what you are asking me to do? Oh, and fro the Status Text I want it to show what the browser is currently doing, like it does in internet explorer and other web browsers.

    Thanks

    Wednesday, January 18, 2006 1:33 AM
  • Sorry if I was unclear... Hopefully this will be a bit better.

    On the ProgressBar what you need to replace "int" with is an integer value that expresses the percentage of work that you're representing that has been completed.

    Let's say that I have 100 of some object to process and I want to update the ProgressBar each time I complete processing one of my objects, I would do something like this:

    For i = 1 to 100 Step 1 
        // Process some object...
        call ProcessMyObject()

        // Increment the ProgressBar's value each time an object is processed.
        myProgressBar.Increment(1);
    Next

    As for the StatusText you're going to have to tell it what you want it to say. I don't believe that there is any automatic way of doing what you're appearing to want it to do. If you want the StatusLabel to say "Loading" you have to do

    myStatusLabel.Text = "Loading"

    If you want it to say "Opening Page", You have to do:

    myStatusLabel.Text = "Opening Page..."

    Basically depending on where you are in your code, and what you're doing you will need to update your StatusLabel's Text property along with the ProgressBar. You need to know how much work you've done, and how much total work needs to be done so you can show how much has been completed. This could involved getting the page's size and then showing the user how much has been downloaded so far, etc etc.

     

    Wednesday, January 18, 2006 2:27 AM
  • Ok, now my only problem is that when I load the page, they don't move. However, when I click on them, they show the value that I would like them to show when the page is loading. Could you help me with that?
    Monday, January 23, 2006 9:41 PM