Hello:
I would like to have something in the MDI Child change something in the MDI Parent.
Can someone tell me of sample or where to look?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Feb 21, 2010, 12:36 AM
then write following in child form
private void button1_Click(object sender, {
((Form1)Application.OpenForms["Form1"]).Lable1.Text = "Your Text ";
}
Purvesh SanganiPosted Dec 3, 2016, 4:14 AM
GustavoPosted Feb 21, 2010, 7:53 AM
Thank much... I like the sample. Now I have to implement it into my projects.
Karan: I tried your, but it gave me an error. I will read up on your sample and try to make it work. Its always nice to have several ways of doing something. Thanks.
Kirtan: I get an error also on yours. Its probably something that I am doing or missing.
??? Is it maybe that I am trying to change the text of a button on the Parent?
((FormICEPack)Application.OpenForms["FormICEPack"]).buttonGio.Text = "Your Text ";
Anyways... All three of you gave me the basics to figure out my issue... Thanks all.
NainilPosted Feb 20, 2010, 11:08 PM
You can get the ParentForm from the MDI Child form and then either iterate through the controls collection and change the text of a label (for example) or you can set a property on the parent form which sets the label's Text. I have attached a sample for your reference.
Karan PatelPosted Feb 20, 2010, 11:04 PM
// write in child form
private void button1_Click(object sender, EventArgs e)
{
this.ParentForm.Controls["label1"].Text="HI..."
}