Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8386753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:01:39+00:00 2026-06-09T18:01:39+00:00

I have searched the site and found similiar topics, but my problem is that

  • 0

I have searched the site and found similiar topics, but my problem is that the explanation / solution is a bit beyond my technical understanding at the moment.

I have only just noticed a “Background Worker” in Visual Studio, and I am using it to login to my database and keep the UI functioning (GIF image to show loading etc).

Problem I am having is that once the login is complete i am updating a label to say “login Complete” etc.

I am getting an error “Cross thread operation not valid”

If possible, could anybody tell me a way i can update a control via the Background Worker, or provide a source that I can use as a resource?

I have never used multi threading before, i understand the reason for the problem, but I dont see how to work around it.

Thanks for your time!

Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:01:40+00:00Added an answer on June 9, 2026 at 6:01 pm

    You have to update your display in the BackgroundWorker event handlers for the ProgressChanged and RunWorkerCompleted events. This will eliminate the cross-thread problems you are experiencing.

    Private Sub backgroundWorker1_RunWorkerCompleted(ByVal sender As System.Object, _
    ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorker1.RunWorkerCompleted
        If e.Cancelled = True Then
            resultLabel.Text = "Canceled!"
        ElseIf e.Error IsNot Nothing Then
            resultLabel.Text = "Error: " & e.Error.Message
        Else
            resultLabel.Text = "Done!"
        End If
    End Sub
    

    http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx#Y2497.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched this site looking for the answer and found similar things, but
I have searched the site and I haven't found an answer to my problem.
I have searched and found a couple of solutions on this site, that didn't
I've searched for similar questions but still have not found a solution as to
I have searched on the net and on this site for a solution but
Preface: I am sure this is incredibly simple, but I have searched this site
I have searched for this, and i found that for api less than 12,
I have searched for a general solution to this but only find answers to
I've searched the site and I have found similar questions, and I have implemented
Okay, so I have searched this site and found many tutorials on how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.