P
Paul
Program A.EXE starts a new Diagnostics.Process to run program B.EXE. I
have the EnableRaisingEvents set to True. When program B.EXE exits the
Exited event fires off, just like I want it to. I can display a
message box stating that B.EXE has exited. I have searched the
Internet and have seen numerous examples of that.
However, what I want to do is enable the button on program A.EXE that
started the B.EXE program process. Below is the code:
Private Sub newProcess_Exited(ByVal sender As Object, ByVal e As
System.EventArgs) Handles newProcess.Exited
'MessageBox.Show("newProcess_Exited")
lblOpenApplication1.Enabled = True
btnOpenApplication1.Enabled = True
End Sub
But I get an "InvalidOperationException" on the
lblOpenApplication1.Enabled = True statement. The error says,
"Cross-thread operation not valid: Control 'lblOpenApplication1'
accessed from a thread other than the thread it was created on."
AAARRRRGGG! Can anyone help me?
I know that I can use a timer to monitor the state of the newProcess.
But I would like to get this to work instead.
have the EnableRaisingEvents set to True. When program B.EXE exits the
Exited event fires off, just like I want it to. I can display a
message box stating that B.EXE has exited. I have searched the
Internet and have seen numerous examples of that.
However, what I want to do is enable the button on program A.EXE that
started the B.EXE program process. Below is the code:
Private Sub newProcess_Exited(ByVal sender As Object, ByVal e As
System.EventArgs) Handles newProcess.Exited
'MessageBox.Show("newProcess_Exited")
lblOpenApplication1.Enabled = True
btnOpenApplication1.Enabled = True
End Sub
But I get an "InvalidOperationException" on the
lblOpenApplication1.Enabled = True statement. The error says,
"Cross-thread operation not valid: Control 'lblOpenApplication1'
accessed from a thread other than the thread it was created on."
AAARRRRGGG! Can anyone help me?
I know that I can use a timer to monitor the state of the newProcess.
But I would like to get this to work instead.