I'm running two processes when a method is called, but I only want the process to run if a related file exists. I need both processes to start running at the same time, but don't want the method execution to continue until both are done. This is all easily done until I make the file.exists check. I get a compiler error:
The type or namespace name 'myProcess' could not be found (are you missing a using directive or an assembly reference?)
This is what I do basically:
setVar1 = false
setVar2 = false
if file.exists
Process myProcess1 = new Process();
myProcess1.start()
setVar1 = true
if file.exists2
Process myProcess2 = new Process();
myProcess2.start()
setVar2 = true
if setVar1 == true
myProcess1.WaitForExit()
if setVar2 == true
myProcess2.WaitForExit()
Rest of code.
If I remove the if statement from the process, it runs fine, but I want to make sure the file exists before I start the process. Is there a way around this?
Thanks
The type or namespace name 'myProcess' could not be found (are you missing a using directive or an assembly reference?)
This is what I do basically:
setVar1 = false
setVar2 = false
if file.exists
Process myProcess1 = new Process();
myProcess1.start()
setVar1 = true
if file.exists2
Process myProcess2 = new Process();
myProcess2.start()
setVar2 = true
if setVar1 == true
myProcess1.WaitForExit()
if setVar2 == true
myProcess2.WaitForExit()
Rest of code.
If I remove the if statement from the process, it runs fine, but I want to make sure the file exists before I start the process. Is there a way around this?
Thanks