Hi,
I've got a question and I hope to find answers.
I've a multi-form project and I need to start a process from Form1 and also have the possibility to kill the launched process if I press a button in Form2.
My problem is that when I've launched the process I use "WaitForExit" to stop execution of the sub (because I need to start different processes in sequence) so I'm not able to press the button in Form2.
Is there a way to have Form2 active even if my program is waiting the process has exited? What I need is to have the possibility to interrupt the execution of the launched process.
I've got a question and I hope to find answers.
I've a multi-form project and I need to start a process from Form1 and also have the possibility to kill the launched process if I press a button in Form2.
My problem is that when I've launched the process I use "WaitForExit" to stop execution of the sub (because I need to start different processes in sequence) so I'm not able to press the button in Form2.
Is there a way to have Form2 active even if my program is waiting the process has exited? What I need is to have the possibility to interrupt the execution of the launched process.
VB.NET:
Dim run_simulation As New System.Diagnostics.Process
run_simulation .EnableRaisingEvents = True
run_simulation .StartInfo.WorkingDirectory = Form1.folder_work
run_simulation .StartInfo.FileName = "run_auto_simulation.bat"
run_simulation .StartInfo.WindowStyle = rocessWindowStyle.Minimized
run_adams.Start()
Form1.Cursor = Cursors.WaitCursor
'Form2 where there is Stop Button to kill run_simulation process
Form2.Show()
Form2.Focus()
run_simulation.WaitForExit()
Form1.Cursor = Cursors.Default