|
Waiting for a Process to Exit
Published: 6/3/2008 |
|
Here's a little trick that allows you to use other programs as if they were modal dialogs in your program. You can launch a process using Process.Start, and then use Process.WaitForExit to block your program until the user closes the other program:
VB:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim clsProcess As System.Diagnostics.Process = Process.Start("explorer.exe", "C:\")
clsProcess.WaitForExit()
MessageBox.Show("All done!")
End Sub
private void Button1_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process clsProcess = Process.Start("explorer.exe", "C:\\");
clsProcess.WaitForExit();
MessageBox.Show("All done!");
}
Questions or Comments? .
VB to C# and C# to VB translation provided by Instant C# and Instant VB.