ahmad molaie
ahmad molaie

Reputation: 1540

messagebox without wait or suspend

I need to show a message box to user, with yes no options, but not to suspend the process of my function, it is a lengthy function that takes a minute or so to complete. the task of messagebox is to asks the user to continue or not. if the user clicks yes, nothing special happens, the work continues to complete, if user don't clicks any buttons, the process must do the task, and when it finishes, the messagebox must disappears, but if the user clicks no, the function must exit.(like the calculator when calculating for example 10000000!).

Upvotes: 1

Views: 750

Answers (2)

Saeed Amiri
Saeed Amiri

Reputation: 22565

For your problem you can write your own form and handle events Also as Mark suggested you can use the benefit of background. In fact message box doesn't have public constructor to create it and assign some events, So you should write it yourself with your own form.

Upvotes: 2

Mark
Mark

Reputation: 108567

Sounds like a good time to use a Background Worker. Keeps the UI responsive, while the background task does the long computation. It supports cancellation.

Upvotes: 6

Related Questions