Reputation: 8327
My event handler UIButton440_TouchUpInside( UIButton sender ) updates my TextBox.Text then does a long loop, then returns. But Textbox doesn't update until after return.
How can I display the updated TextBox immediately?
(Like vb.net does with application.doEvents)
Upvotes: 0
Views: 658
Reputation: 27878
Assuming you're using Windows Forms, you can call the Update
method on the TextBox
to force a refresh.
yourTextBox.Update();
Upvotes: 1
Reputation: 184
You can try firing a thread to do your long loop. I usually like using workers for that, something like this:
txt.Text = "abc";
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (o, ea) =>
{
//Long loop
};
worker.RunWorkerCompleted += (o, ea) =>
{
//Do something when the loop ends
};
worker.RunWorkerAsync();
Upvotes: 3