| | |
How to use multiple forms and UserControls in c# windows application?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2007
Posts: 5
Reputation:
Solved Threads: 0
How to use multiple forms and UserControls in c# windows application?
Where i have one toolStrip in UserControl1 (say UserControl1.cs) and onClick of ToolStripButton1
i need to open on Form1 (say Form1.cs) and Form1.cs contain only One RichTextbox control.
now i need to fetch Form1.cs richtextbox control value (text) onClick of another button of toolstripbutton2 (in Usercontrol1.cs).
Please suggest me to do this
Thanks
Chirag
Where i have one toolStrip in UserControl1 (say UserControl1.cs) and onClick of ToolStripButton1
i need to open on Form1 (say Form1.cs) and Form1.cs contain only One RichTextbox control.
now i need to fetch Form1.cs richtextbox control value (text) onClick of another button of toolstripbutton2 (in Usercontrol1.cs).
Please suggest me to do this
Thanks
Chirag
•
•
Join Date: Jul 2008
Posts: 89
Reputation:
Solved Threads: 10
This is how to add a new control.
Mi idea is.
1.On the UserControl1.cs create a 2 propertys one for 'toolStrimpButton1' and another for 'toolStripButton2'.
2.On the Form2.cs create a property for the RitchTextBox.
3.
On Form1.cs create a new instance of UserControl1 and add it to the form(as showed above).
Subscribe to the click event of each UserContro1's buttons(e.i ToolStripButton1.Click += new EventHnadler(ShowForm2)) and implement the handler
If you want information about 'event' see these links(both links belong to one article but these are the topics you nedd for solving your problem).
http://www.codeproject.com/KB/cs/eve...registration20
http://www.codeproject.com/KB/cs/eve...ndlingMethod23
Thanks,
Camilo
C# Syntax (Toggle Plain Text)
public class Form1 { private UserControl1 userControl; public Form1() { InitializeComponent(); userControl = new UserControl1(); this.Controls.Add(userControl); } }
Mi idea is.
1.On the UserControl1.cs create a 2 propertys one for 'toolStrimpButton1' and another for 'toolStripButton2'.
2.On the Form2.cs create a property for the RitchTextBox.
3.
On Form1.cs create a new instance of UserControl1 and add it to the form(as showed above).
Subscribe to the click event of each UserContro1's buttons(e.i ToolStripButton1.Click += new EventHnadler(ShowForm2)) and implement the handler
If you want information about 'event' see these links(both links belong to one article but these are the topics you nedd for solving your problem).
http://www.codeproject.com/KB/cs/eve...registration20
http://www.codeproject.com/KB/cs/eve...ndlingMethod23
Thanks,
Camilo
Last edited by camilojvarona; Jul 11th, 2008 at 7:23 am.
![]() |
Other Threads in the C# Forum
- Previous Thread: Need some idea
- Next Thread: Form in Different Shapes
| Thread Tools | Search this Thread |
.net 2007 access ado.net algorithm array barchart bitmap box broadcast buttons c# camera check checkbox client color combobox control conversion cs4 csharp custom database datagrid datagridview dataset date datetime degrees development draganddrop drawing encryption enum event eventcloseformc# excel file form format forms function gdi+ httpwebrequest image index input install java label list listbox listener listview load mandelbrot math mouseclick mysql operator path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox search security serialization server sleep socket sql statistics stream string table text textbox thread time timer update usercontrol validation view visual visualstudio webbrowser windows winforms wordautomation wpf xml





