R
Raymond Lewallen
How to wait for a process to stop completion is my goal. Obviously, the
looping while waiting for the HasExited property is not a solution.. but
thats the best I can come up off the top of my head. Natuarally it will not
work. I expect it to use up all resources looping, which will not allow the
process to complete. The process takes about 60 seconds, because the .bat
file it is calling is rebuilding mulitple .NET solutions and projects and
copying the assembly files out to other directories.
So in short, I'm looking for an efficient way to wait for the process to
complete before continuting to execute the remainder of the code in the Sub.
I have the following code (only what you need to help me, if you need to see
more, let me know, but the government doesn't like me putting a bunch of
source code out there if it isn't relevant.):
**********************************************
Public Class frmMerge
Private processRebuildAW As Process
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCreate.Click
ClearListBox()
ClearProgressBar()
#If Not Debug Then
IF chkRebuildAW.Checked = True Then RebuildAWPath()
Do While Not (processRebuildAW.HasExited)
' RIGHT HERE IS MY PROBLEM
Loop
#End If
lblReadyCount.Text = Convert.ToString(lstFiles.Items.Count)
blah blah blah more code more code more code
End Sub
Private Sub RebuildAWPath()
Dim strPath As String = Application.StartupPath & "\rebuildawpath.bat"
processRebuildAW = Process.Start(strPath)
End Sub
End Class
**********************************************
looping while waiting for the HasExited property is not a solution.. but
thats the best I can come up off the top of my head. Natuarally it will not
work. I expect it to use up all resources looping, which will not allow the
process to complete. The process takes about 60 seconds, because the .bat
file it is calling is rebuilding mulitple .NET solutions and projects and
copying the assembly files out to other directories.
So in short, I'm looking for an efficient way to wait for the process to
complete before continuting to execute the remainder of the code in the Sub.
I have the following code (only what you need to help me, if you need to see
more, let me know, but the government doesn't like me putting a bunch of
source code out there if it isn't relevant.):
**********************************************
Public Class frmMerge
Private processRebuildAW As Process
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCreate.Click
ClearListBox()
ClearProgressBar()
#If Not Debug Then
IF chkRebuildAW.Checked = True Then RebuildAWPath()
Do While Not (processRebuildAW.HasExited)
' RIGHT HERE IS MY PROBLEM
Loop
#End If
lblReadyCount.Text = Convert.ToString(lstFiles.Items.Count)
blah blah blah more code more code more code
End Sub
Private Sub RebuildAWPath()
Dim strPath As String = Application.StartupPath & "\rebuildawpath.bat"
processRebuildAW = Process.Start(strPath)
End Sub
End Class
**********************************************