Hi @HaaleHao-6958 ,Welcome to A&A,
When the button is clicked, the button5_Click method is called on the UI thread.
This method then starts executing the Test3 method asynchronously, delaying for 2 seconds before displaying the message box.
When the message box is displayed, the UI thread is indeed blocked, which means that the code behind the message box will not execute until the message box is closed.
However, the textBox1.Text property is being updated in a loop before the message box is displayed, so the loop continues to execute on the UI thread while the message box is displayed.
As the code shows, it executes on thread 1.
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.