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,221 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
  • 2
4 Comments
 
LVL 1

Expert Comment

by:andyalmq
Comment Utility
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
Comment Utility
Thanks
0
 
LVL 19

Expert Comment

by:Desp
Comment Utility
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
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now