Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

process decision causes build failure

Status
Not open for further replies.

mbutch

Programmer
Nov 17, 2000
100
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top