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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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