Change labels and other objects when Backgroundworker is done.

Hi all.

Running a BGW - when it starts a change a label to "Running Task," when the BGW is done I want to change the text to "Done with task." I assumed this could be done in the BGW_RunWorkerCompleted(), but it is not working andOr I am wrong. Thanks for the correction in advance...
Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
        If Not (e.Error Is Nothing) Then
        ElseIf e.Cancelled Then
            lblResult.Text = "Cancelled"
            lblResult.Text = "Done"
        End If
        SaveToolStripMenuItem.Enabled = True
        ProgressBar1.Value = 0
    End Sub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
It really should work. Have you set the WorkerReportsProgress property to True? Have a look at

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hawkvalley1Author Commented:
Hi emoreau, why yes I did. And yes I have read your article - we just worked on the progressbar earlier.
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
I think we would need to more code then to figure out what is wrong...
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Éric MoreauSenior .Net ConsultantCommented:
>>we just worked on the progressbar earlier

I don't look at the names when I post comments.

Is it the BackgroundWorker1 instance that you start or are you starting a new instance?

Can you show more code?
Éric MoreauSenior .Net ConsultantCommented:
if you try my sample, is it working?
Hawkvalley1Author Commented:
Do I need to make the BGW a new instance, I was only needing this operation once and then the form closes? I am just using the control I dropped onto the form.
Éric MoreauSenior .Net ConsultantCommented:
I just retried my sample and this event is working. Do a quick comparison and you should find where the difference lies.
Hawkvalley1Author Commented:
Ok I see, don't deviate from the plan Stan... sometimes it is the littlest darn things that mess it all up - all better in code land...
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Lol...glad you figured it out.  =)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.