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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:28:32+00:00 2026-06-16T06:28:32+00:00

I have a form with text box and button. On click of button I’m

  • 0

I have a form with text box and button. On click of button I’m creating a thread and invoking it for some operation. once the thread completes the invoked task, I want to update the text box with the result.

any one please assist me how can I achieve this without thread clash.

  • 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-16T06:28:33+00:00Added an answer on June 16, 2026 at 6:28 am

    This is far simpler using .NET 4.0’s Task class:

    private void button_Click(object sender, EventArgs e)
    {
        Task.Factory.StartNew( () => 
        {
             return DoSomeOperation();
        }).ContinueWith(t =>
        {
             var result = t.Result;
             this.textBox.Text = result.ToString(); // Set your text box
        }, TaskScheduler.FromCurrentSynchronizationContext());
    }
    

    If you’re using .NET 4.5, you can simplify this further using the new async support:

    private async void button_Click(object sender, EventArgs e)
    {
        var result = await Task.Run( () => 
        {
             // This runs on a ThreadPool thread 
             return DoSomeOperation();
        });
    
        this.textBox.Text = result.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form containing a Clear Button, usercontrol. The userControl has some text box
In my windows form I have a text box and a button, the text
I have a text box and a button in a form.i want to save
I have a form with a text box and button, such that when the
I have a form with an input textbox and a button. When I click
i have form where i have text box value and link (add). when user
I have a form in which i have a text box for email and
I have a C# form that has a text box that needs to constantly
i have a text box on my form. I want to write 0x31 as
I have a text box and many buttons. When user is in some text

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.