Spawning Gams with vb.net or C#

Hi to everyone
I have a problem with Gams when spawning a process from vb.net or c#
The thing is that after running the program and completing the
execution correclty, if I open GAMSIDE and the .gms file that VB used,
I cannot save modifications. It seems that an instance of the file
remains running after the code was completed and does not allow you to
acccess the file for modification.
Does someone know how to kill that instance on the vb code?
Thanks

\

Dear José,

I´m running a GAMS model from C# without troubles. This is the code i
used:

Process p = new Process();
p.EnableRaisingEvents = false;
p.StartInfo.FileName = gamsDir + “\” + gamsExe;
p.StartInfo.WorkingDirectory = workingDirectory;
p.StartInfo.Arguments = workingDirectory + “\” +
gamsModel + " o=nul lo=0";
p.Start();
p.WaitForExit();

I hope it could help you.
Regards

Ing. Aldo Rubiales

Instituto PLADEMA
U.N.C.P.B.A.
Pinto 399 Tandil (7000)
Buenos Aires, Argentina
Tel/FAX: +54 2293 439690


On Feb 25, 5:16 pm, José Miguel Quesada wrote:

Hi to everyone
I have a problem with Gams when spawning a process from vb.net or c#
The thing is that after running the program and completing the
execution correclty, if I open GAMSIDE and the .gms file that VB used,
I cannot save modifications. It seems that an instance of the file
remains running after the code was completed and does not allow you to
acccess the file for modification.
Does someone know how to kill that instance on the vb code?
Thanks

\

Hola Aldo
Muchas gracias por el dato.
Voy a intentarlo y te aviso los resultados.
Saludos
José Miguel


-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On
Behalf Of Aldo Rubiales
Sent: sábado, 26 de febrero de 2011 03:00 p.m.
To: gamsworld
Subject: Re: Spawning Gams with vb.net or C#

Dear José,

I´m running a GAMS model from C# without troubles. This is the code i
used:

Process p = new Process();
p.EnableRaisingEvents = false;
p.StartInfo.FileName = gamsDir + “\” + gamsExe;
p.StartInfo.WorkingDirectory = workingDirectory;
p.StartInfo.Arguments = workingDirectory + “\” + gamsModel + "
o=nul lo=0";
p.Start();
p.WaitForExit();

I hope it could help you.
Regards

Ing. Aldo Rubiales

Instituto PLADEMA
U.N.C.P.B.A.
Pinto 399 Tandil (7000)
Buenos Aires, Argentina
Tel/FAX: +54 2293 439690


On Feb 25, 5:16 pm, José Miguel Quesada wrote:

Hi to everyone
I have a problem with Gams when spawning a process from vb.net or c#
The thing is that after running the program and completing the
execution correclty, if I open GAMSIDE and the .gms file that VB used,
I cannot save modifications. It seems that an instance of the file
remains running after the code was completed and does not allow you to
acccess the file for modification.
Does someone know how to kill that instance on the vb code?
Thanks

\

Thanks for your answer Aldo
The code I had was ok - it was basically the same as yours.
The problem was not the code, but the administrative permissions of
the folder in which I was running the file. I changed the permissions
and I have no problem at all now.
Thanks anyway.
Jose Miguel

\

José,

That´s right, you need administrative permissions for run it. It´s
good to know that you solve your problem. I´ve been working in
writing .gdx files from C# code. If you are thinking on passing data
to GAMS by this way, I can send you the code too.

Regards,
Aldo.

\

Thank you Aldo.
I hadn’t thought about that possibility, but I’ll keep it in mind if I
require it. Maybe I won’t on this project, but for future projects might be
a good idea.
Regards
Jose Miguel

-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On
Behalf Of Aldo Rubiales
Sent: martes, 01 de marzo de 2011 05:14 p.m.
To: gamsworld
Subject: Re: Spawning Gams with vb.net or C#

José,

That´s right, you need administrative permissions for run it. It´s
good to know that you solve your problem. I´ve been working in
writing .gdx files from C# code. If you are thinking on passing data
to GAMS by this way, I can send you the code too.

Regards,
Aldo.

\