baby_vb Posted February 10, 2004 Posted February 10, 2004 Hi all, I'm 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 it's 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! :) Quote
rifter1818 Posted February 10, 2004 Posted February 10, 2004 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 Quote
baby_vb Posted February 12, 2004 Author Posted February 12, 2004 Oh my goodness. Yes it was that. I forgot to instantiate. *blush* Thank you very much. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.