Hi @~OSD~ ,
You can also consider using Task.ContinueWith method which creates a continuation that executes asynchronously when the target Task completes.
Here's the code you can refer to.
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Task.Factory.StartNew(AddressOf CopyDirectory).ContinueWith(Sub(task)
Process.Start("D:\CopyFileDemo\MyData\MyApp.exe")
End Sub)
End Sub
Private Sub CopyDirectory()
My.Computer.FileSystem.CopyDirectory("C:\CopyFileDemo", "D:\CopyFileDemo")
End Sub
Hope it could be helpful.
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
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.