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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:20:57+00:00 2026-05-19T02:20:57+00:00

So I have a thread in my application, which purpose is to listen to

  • 0

So I have a thread in my application, which purpose is to listen to messages from the server and act according to what it recieves.

I ran into a problem when I wanted to fire off a message from the server, that when the client app recieves it, the client app would open up a new form. However this new form just freezes instantly.

I think what’s happening is that the new form is loaded up on the same thread as the thread listening to the server, which of course is busy listening on the stream, in turn blocking the thread.

Normally, for my other functions in the clients listening thread, I’d use invokes to update the UI of the main form, so I guess what I’m asking for is if here’s a way to invoke a new form on the main form.

  • 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-19T02:20:58+00:00Added an answer on May 19, 2026 at 2:20 am

    I assume this is Windows Forms and not WPF? From your background thread, you should not attempt to create any form, control, etc or manipulate them. This will only work from the main thread which has a message loop running and can process Windows messages.

    So to get your code to execute on the main thread instead of the background thread, you can use the Control.BeginInvoke method like so:

    private static Form MainForm; // set this to your main form
    
    private void SomethingOnBackgroundThread() {
    
        string someData = "some data";
    
        MainForm.BeginInvoke((Action)delegate {
    
            var form = new MyForm();
            form.Text = someData;
            form.Show();
    
        });
    }
    

    The main thing to keep in mind is that if the background thread doesn’t need any response from the main thread, you should use BeginInvoke, not Invoke. Otherwise you could get into a deadlock if the main thread is busy waiting on the background thread.

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

Sidebar

Related Questions

I have a layered application in Java which has a multi thread data access
I have developed web application which uses JasperReports for reporting purpose. In that I
I have two threads in an Android application, one is the view thread, and
Im looking to build a thread manager for an application. I have already started
I have a server application that uses a lot of threads. Without wanting to
I have thread exception handler which saves the exception stack trace and should close
I have one thread that writes results into a Queue. In another thread (GUI),
In general, if you have a class that inherits from a Thread class, and
I have a client server application and for testing purposes I need to start
I have a console application which is intended to just keep running until it

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.