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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:54:00+00:00 2026-05-13T10:54:00+00:00

UPDATE: Just to summarize what my question has boiled down to: I was hoping

  • 0

UPDATE: Just to summarize what my question has boiled down to:

I was hoping that constructing .NET forms and controls did NOT create any window handles — hoping that process was delayed until Form.Show/Form.ShowDialog

Can anyone confirm or deny whether that is true?


I’ve got a large WinForms form with tab control, many many controls on the form, that pauses while loading for a couple seconds. I’ve narrowed it down to the designer generated code in InitializeComponent, rather than any of my logic in the constructor or OnLoad.

I’m well aware that I can’t be trying to interact with the UI on any thread other than the main UI thread, but what I’d like to do is to have the application pre-load this form (run the constructor) in the background, so it’s ready for display on the UI thread instantly as soon as the user wants to open it. However, when constructing in a background thread, on this line in the designer:

this.cmbComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;

I’m getting the error

Current thread must be set to single
thread apartment (STA) mode before OLE
calls can be made. Ensure that your
Main function has STAThreadAttribute
marked on it.

Now this is halfway down the designer file, which gives me hope that in general this strategy will work. But this particular line seems to be trying to instantly kick off some kind of OLE call.

Any ideas?

EDIT:

I think I’m not making myself clear here. The delay seems to take place during the construction of a bazillion controls during the designer-generated code.

My hope was that all this initialization code took place without actually trying to touch any real Win32 window objects since the form hasn’t actually been shown yet.

The fact that I can set (for example) Label texts and positions from this background thread gave me hope that this was true. However it may not be true for all properties.

  • 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-13T10:54:00+00:00Added an answer on May 13, 2026 at 10:54 am

    The answer is no.

    If you create a window handle on any thread other than the GUI thread you can never show it.

    Edit: It is completely possible to create Forms and controls and
    display them in a thread other than the main GUI thread. Of course if
    you do this you can only access the multi threaded GUI from the thread
    that created it, but it is possible. – Ashley Henderson

    You need to perform any heavy lifting on a bg thread and then load the data into you GUI widget

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

Sidebar

Related Questions

I have developed a windows forms c# application, i just want update items in
I just did an update of my SDK and now eclipse is giving me
Just to keep things interesting and close my final open question, the solution that
I have a table which has 3 triggers of update (just for the scenario)...
I just want to clarify one thing. This is not a question on which
UPDATE: Just to be clear, I'd like to check the key-value of the 'name'
Update: I just tested my JSON format returned from the server using JSONlint and
I just update firefox and they use a smooth slide effect(When the mouse wheel
I just update my ADT and SDK to latest version of ADT r20 and
Update I have just tried Pinning my site to the Taskbar again (after removing

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.