Question is : How you could display in the text of the label in the second form;
the content of the textbox in the first form?
Answer is:
Step 1:
In form1 drag a textbox control and name it textbox1.
Step 2:
In Form1.Designer.cs search where the textbox has been declared
Step 3:
After the "region" ther is one declaration as:
private System.Windows.Forms.TexBox textbox1;
Step 4:
Change the access modifier to "public".
Step 5:
Now add another form to the project by right-clicking the mouse over the project
in the Solution explorer.
Step 6:
A form with form2 as a name is displayed.
Step 7:
Drag two controls from the toolbox, one a label control ,another a button control,
into form2.cs[Design].
Step 8:
Name the Label control as "label1" and the button control as "button1".
Step 9:
Now from Form2.cs[Design], double-click the mouse over the button control.
Step 10:
Now in "public partial class Form2 : Form
declare a global object ,f1, of Form1 type
Step 11:
Now in "private void button1_Click(object sender, EventArgs e)"
write :-
f1.show();
string str;
str=f1.textbox1.Text;
label1.Text = str;
Step 12:
Now execute.
Runtime co-ordination of controls residing in two different forms
Its all about accessing one control in one form from another control in another form.


Join the conversation! Your thoughts help the community grow.