Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Guys,


//On a click of button,i am writing the below code.
//
System.Diagnostics.Process.Start("Myapplication.exe", Argument1);

if i click the button, Myapplication.exe gets executed and i am passing Argument1 to it,it works fine for me.

Query: if i second time click button,again i get another instance of Myapplication.exe that i do not want,i want to pass Argument2 in first instance of Myapplication.exe.
can you please suggets a way to do it.

Thanks in advance.
Posted

Your Question is not clear or let us know what are you trying to do?

From your existing approach it will not be possible as when you first time calls Myapplication.exe then its taking first argument and process is completing successfully and that process is no longer available so you cant use that process.

Even, if your application has not completed execution you can not pass argument again to same process as Argument is getting passed in Sub Main() which being called only once at starting the process.

Let us know what you are trying to achieve by passing second argument.

Regards
Rushikesh Joshi
 
Share this answer
 
It appears that you are trying to pass multiple arguments to a single instance of your application using command line arguments.
Read this MSDN article[^] to see how this is done.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900