I want to change form1 textbox1 text from from2 variable.
This is the flow.
- Show form1
- click button in form1
- then show form2 (form1 do not hide. It is still visible)
- click button in form2 (form2 has variable and it set to form1 text box and hide form2)
(In my system form1 is always show)
This is my code in form1 for access textbox from other form
//FIRST CODE BLOCK
public string textRoomID
{
get
{
return this.txt_RoomID.Text;
}
set
{
this.txt_RoomID.Text = value;
}
}
This is the code of form2 button click
//SECOND CODE BLOCK
form1 obj_f1 = new form1(); //create the object of
obj_f1.textRoomID = RoomID; //Assign variable
this.Hide();
When I debugging the code set method is working well and it is not showing any error.
But not update my text box.
if I use this flow, above code worked.
- form2 show
- form2 button click (SECOND CODE BLOCK execute and additionaly added form1.show();)
But my requirment is first i mensioned flow.
How to do my work? Why it is not assigning value to text box?