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

  • SEARCH
  • Home
  • 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 7061835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:31:20+00:00 2026-05-28T04:31:20+00:00

I have two questions about using a BackgroundWorker: 1)Lets say you have Function A

  • 0

I have two questions about using a BackgroundWorker:

1)Lets say you have Function A and Function B. Function A creates a BackgroundWorker which runs Function B. So the BackgroundWorker is now running Function B on a separate thread. Function B is an infinite while loop that I intend to run for a long duration. After Function A uses the BackgroundWorker through, it returns. So now that the function that initiated the BackgroundWorker (Function A) has returned, does the BackgroundWorker thread keep running in the background? Or does it stop running Function B since the function that instantiated it has returned? If it does stop, how would I make it so that Function B continues to run even after Function A has returned?

2)I need to access Window Forms Items (i.e. Textbox) from a separate thread created by a BackgroundWorker. However if I try to access Window Forms Items from a thread that is not main, I get a cross threading error. How could I safely access Window Forms Items from a separate thread? I basically need to keep updating a textbox from a separate thread. I know a BackgroundWorker has a member called “RunWorkerCompleted” and that is run after the BackgroundWorker completes its job. It allows me to access Window Forms Items from this. However, I need to access a Window Forms Item during the duration of my thread rather than after its completion. How could I access these safely through a thread? If this isn’t possible what are some other possible solutions to the problem?

  • 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-05-28T04:31:20+00:00Added an answer on May 28, 2026 at 4:31 am

    1) The BackgroundWorker will continue to run after Function A returns.

    2) Create a ProgressChanged event handler that updates the text box, and have the BackgroundWorker call ReportProgress whenever you want to change the text. Of course, you’ll have to make the BackgroundWorker set a property that the ProgressChanged event can read. This works because the ProgressChanged event handler is called on the UI thread.

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

Sidebar

Related Questions

I have two questions about C's fread function: I have read that fread is
i'm searching about image filters using ios5 sdk but i have two questions: For
I have two questions about java.awt.Shape . Suppose I have two Shape s, shape1
So I have two questions about HashMap s in Java: What is the correct
I have two noobish questions about Flash, Actionscript, Flex etc. 1) With these technologies
I have two questions: 1) How can I make an array which points to
I have two questions about creating thread safe types in python, and one related
I have two small problems/questions about app development in Windows Phone 7. 1: I
I've got two questions about Asp.Net MVC areas. I have only a shallow understanding
My work company has a MSSQL server 2005. I have two questions about finding

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.