exe not being called

baby_vb

Member
Joined
Nov 3, 2003
Messages
9
Hi all,

Im trying to call an executable from my VB application, like this:

psi.FileName = "program.exe"
psi.Arguments = sArgs sArgs is a string from a text box
psi.WorkingDirectory= "C:\MATLAB6p\bin\newwork\Optimize_subs"
p = Process.Start(psi)


except when I call it, I get this error:

An unhandled exception of type System.NullReferenceException occurred in Project1.exe

Additional information: Object reference not set to an instance of an object.


and the debugger points to the line where the file name is declared.

Is this a program in the executable with the way its receiving the parameter string, or is the executable not getting called at all, I was thinking maybe a problem with the working directory (yes, the exe is in the right folder). Does anyone know?

Thanks! :)
 
Did you forget to create a new instance?

psi = new process()
at least i think your using processes and i dont know if there are any arguments needed for the new call,.. but thats the usual fix for that error in my experiance
 
Back
Top