Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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! :)

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...