SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

Sending information between SDI C# Forms.

To send information or accessing functions from one form to another is easy with .NET Windows Forms.

Create an empty C# Windows Forms project. On Form1, add a Button control and a Textbox control. Set the TextBox control to public access using the public keyword or in the properties set the Modifiers to public. In the Solutions Explorer create a second form named Form2 and add a single button control to form2.
On the Form1 button control click event add the following code.

Form2 form2 = new Form2();
//The following line adds form2 to the collection of owned forms, owned by form1.
this.AddOwnedForm(form2);
//Call and show the form.
form2.Show();

On Form2 's button click event add the following code.

//Create a reference to form1.
Form1 form1 = (Form1)this.Owner;
//Set the text value for form1 textbox1.
form1.textBox1.Text = "Transfer Text";

Run the project and you can see just how easy it is to send information between SDI forms.

Sending information between MDI C# Forms.

To send information or accessing functions from the MDI form to child forms is easy with .NET Windows Forms.

Create an empty C# Windows Forms project. On Form1 set the IsMdiContainer to true, add a Button control and a Textbox control to the form. Set the TextBox control to public access using the public keyword or in the properties set the Modifiers to public. In the Solutions Explorer create a second form named Form2 and add a single button control to form2.
On the Form1 button control click event add the following code.

Form2 form2 = new Form2();
//Set Form2's MdiParent to Form1.
form2.MdiParent = this;
//Call and show the form.
form2.Show();

On Form2 's button click event add the following code.

//Create a reference to form1.
Form1 form1 = (Form1)this.MdiParent;
//Set the text value for form1 textbox1.
form1.textBox1.Text = "Transfer Text";


Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces