2
Reply

Hiding panel control of parent form when child form is shown

monika m

monika m

Aug 16 2013 9:16 AM
2.3k

I am trying to hide Panel control of parent Form2 when button is clicked in GroupSelect childformthat opens another child form GroupExmStart,when this GroupExmStart form gets open than panel4 sholuld hide and when it closes than it should be visible ,I tried following code but its not working and nothing is happning also ,where I am going wrong ,how I can do it in right way

Parent Form

public partial class Form2 : Form
    {
      public Control control
        {
            //using this I accessed panel4 in child form GroupSelect
            get {return this.panel4; }
        }
    }

Child Form

    public partial class GroupSelect : Form
    {
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm2 = new Form2(lgnName);
            frm2.panel4.Visible = false;

            GroupExmStart grpexamfrm = new GroupExmStart(GrpID, DurationID, lgnName);
            grpexamfrm.MdiParent = this.ParentForm;
            //showing another child form and 
            grpexamfrm.Show();
        }
    }

Thanks in advance for any Help


Answers (2)