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 7159365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:13:09+00:00 2026-05-28T13:13:09+00:00

I don’t think I’ve quite found what I’m looking for, and unsure if possible…

  • 0

I don’t think I’ve quite found what I’m looking for, and unsure if possible… I’ve worked with background workers to do processes and during certain “ProgressChanged” events to pull messages from the background worker and update a given window dialog. No problem.

New item… During a certain process that I am trying to have running on a background worker, depending on certain condition, I need it to actually call up a new Window dialog to get user input before resuming its operation… In pseudo format..

Start Window
Click Button For Action
Create BackgroundWorker (BGW) and enable progress changed
Link BGW "ProgressChanged" to CurrentWindowCheckProgress method
run BGW process

In the BGW, under certain condition, I update the progress and have a flag on the BGW that I need specific dialog X to be shown to the user. So, via the ReportProgress(), the hook to the CurrentWindowCheckProgress method is hit (which is on the UI thread). This method sees the flag and needs to create a new Window(), get answer from that, THEN return back to the BGW thread to continue.

So far, all the logic works as planned, but I’m getting an error

“The calling thread must be STA, because many UI components require this.”

So, how / what do I need to do to show the user my interim form “TestPromptWindow”.

This is C#, WPF, VS2010, .Net 4.0

  • 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-28T13:13:10+00:00Added an answer on May 28, 2026 at 1:13 pm

    This is not what backgroundworkers are designed for. The messaging BGW does for you is completely asynchronous. Technically it is posssible to use Control.Invoke to run code on the UI thread, but it could be that this Invoke call is run out of order with your progress updates, as it may have a different message priority.

    The next release of .net will provide very nice support for this. meanwhile, you can use the Task class, especcially its continueWith member. Here is a nice example showing how to go back and forth to the UI thread.

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

Sidebar

Related Questions

don't know what happened in my jcrop selection. I think I pressed some keys
I don't know why, but this code worked for me a month ago... maybe
Don't ask why but I have the requirement to draw a border around certain
Don't think that I'm mad, I understand how php works! That being said. I
Don't think my virtualhost is working correctly. This is what I have inside of
Don't know is it possible to copy elements from one map to another map
Don't know if this is possible, but I have some code like this: val
Don't understand, if Data.Map is and [] is. I found this out while wondering
don't know if this is possible.. I'm using sqlite3 schema: CREATE TABLE docs (id
Don't mind me, I fricked up my attribute names :( This is entirely possible,

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.