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 main method, could you help me?
Edit: I want to start in Programm1 the main method from programm2,开发者_如何学C the assembiliti from programm2 i added to programm1
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
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.
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");
精彩评论