|You're calling WaitForExit before the process even has a chance to start. Starting a new process is a very expensive call. The Start method does not wait for the process to completely start before returning.
It's up to you to wait for the app to start, by calling
p.WaitForInputIdle before you call the
himangshuS wrote:Now if I click the button(run calc),I dont want to open a new calc,...instead I want to bring the already running calc on top.)
Then you have to check to see if it's still running (the user may have closed it), relaunch it if needed, easily done using the Process class. If it's still running, then you can get the ProcessId from its Process object, than pass that to AppActivate to bring it to the front.