Hi how can I change text value of text box in parent window from child window..
i.e I have parent window have textbox1 and button and child window has textbox2 and button. I need to update the value of textbox1 when I enter some text in child window's textbox2.
i did some simple function to do this logically its correct but its not working I have no idea why..
parent.cs
namespace digdog
{
public partial class parent : Form
{
public parent()
{
InitializeComponent();
}
public void changeText(string text)
{
textbox1.Text = text;
}
private void button1_Click(object sender, EventArgs e)
{
//Display modal dialog
child myform = new child();
myform.ShowDialog();
}
}
}
child.cs
namespace digdog
{
public partial class child : Form
{
public child()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
parent mytexts = new parent();
mytexts.changeText(textbox2.Text);
}
}
}
any ideas will be appreciated thanks in advance