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();
}