Solved

How do you link two forms together in C# (these are both .cs and are both forms)

Posted on 2003-11-04
4
1,266 Views
Last Modified: 2008-03-03
I would like to know how to  link two forms together (both .cs and both forms)

Well really it's when the user clicks on the button it takes them to another form.
0
Comment
Question by:paulddaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:andyalmq
ID: 9679179
Lets say the class names of your two forms were Form1 and Form2.  on the click event of the button, you could do

Form2 newForm = new Form2();
newForm.Show();

You may want to define the second form as a member for the first so that you can have a reference to it.  make the class a private member variable in your class:

private Form2 newForm;

and then from your click event add this instead:
newForm = new Form2()
newForm.Show();
0
 

Author Comment

by:paulddaw
ID: 9679654
Thanks
0
 
LVL 19

Expert Comment

by:Desp
ID: 9680001
Check this:
Communication Between Two Forms
http://www.c-sharpcorner.com/Code/2002/June/CommBetweenForms.asp
0
 
LVL 19

Accepted Solution

by:
Desp earned 125 total points
ID: 9680060
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to sort columns in DataGridView 4 64
Securing WEBAPI on Azure 2 55
parsing question on dynamic concatenation 3 40
C# Change the instruction to user. 11 39
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question