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,271 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 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