I created a program with twoo projets like Client and Server.
To open a form in a button click with one prject goes like following:

 private void buttonOpenForm_Click(object sender, EventArgs e)
        {

            Form2 frmForm2 = new Form2();
            frmForm2.Show();
        }

If I'm calling the Form2 from Server project, I don't know how to open this Form2 if exists in Client project.

Recommended Answers

All 3 Replies

First, in the server project, you must add a reference to the client namespace (if the two project are not in the same namespace).

Then you can start the form as usual, for instance :

            Application.Run(new Form2());

I meaned how to open forms from different namespaces.
I created a program from twoo namespaces, in second namespace I have 4 forms which ones somehow using .Net and .Net.Sockets need to communicate with one form in first namespace.
P.S. The data of namespace2 forms are stored in three text files inside namespace1.
One more question: If I press debug, the form form namespace one is not Showing. How to fix it.
Thank you in advance for your reply.

Again, you must add a reference to the namespace where your form is.

"Add a reference" is an option of VS that can be triggered in several ways, for instance in VS2010 :
- in the solution explorer, right click the name of your project. A menu will appear, select "Add a reference".
- Select your projet; in the Project tag of VS main menu, select "Add a reference" ...
- in solution explorer, select your project, select "reference", right click it ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.