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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Feb 20, 2010, 7:36 PM EST
then write following in child form
private void button1_Click(object sender, {
((Form1)Application.OpenForms["Form1"]).Lable1.Text = "Your Text ";
}
Karan Patel120 reputationPosted Feb 20, 2010, 6:04 PM EST
// write in child form
private void button1_Click(object sender, EventArgs e)
{
this.ParentForm.Controls["label1"].Text="HI..."
}
Nainil148 reputationPosted Feb 20, 2010, 6:08 PM EST
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.
GustavoRank #1,990 · 732 reputationPosted Feb 21, 2010, 2:53 AM EST
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.
Purvesh Sangani46 reputationPosted Dec 2, 2016, 11:14 PM EST