How to start a c# program from another c# program in the same map?

后端 未结 3 1438
轮回少年
轮回少年 2021-01-26 22:41

i have two simple c# form programs, and I want to make a button in the first program start the other form when i click it, but i dont know how to access the other programm.cs ma

相关标签:
3条回答
  • 2021-01-26 23:11

    You can use Process.Start to run a new process.

    See http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(VS.71).aspx for the docs.

    0 讨论(0)
  • 2021-01-26 23:13

    You have to use the Process class of the System.Diagnostics namespace to start the second program, refer to this article on the MSDN,

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process(VS.71).aspx

    0 讨论(0)
  • You can't access a form or a method of the other program. One reason is that it's a separate program, another reason is that it's not running.

    What you can do is to start the other program:

    Process.Start("TheOtherProgram.exe");
    
    0 讨论(0)
提交回复
热议问题