At least two possible solutions:
Backgroundworker
Use BackgroundWorker to execute your code, and use RunWorkerCompleted to execute code that runs after completion.
A BackgroundWorker wraps an event-based asynchronous template in a very easy-to-use mechanism, complete with progress and cancellation reports. See BackgroundWorker Tutorial and this answer.
Tasks (.NET 4.0 and higher)
Use the Task object and use ContinueWith to determine the code that should be executed after the completion of the first task.
source share