1

I want to hide panel in UserControl when button clicked in my main form I saw these codes:

public void button1_Click(object sender, EventArgs e) 
{
    if(ButtonClick != null)
        ButtonClick(this, e);
}

obj.ButtonClick += (Sender, e) => 
{
    splitContainer1.Panel2.Controls.Add(obj2);
};

but I don't know how to use it for my project I think it has to be Reverse in project

Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57
KnightM
  • 25
  • 1
  • 5

1 Answers1

0

Try this:

public void button1_Click(object sender, EventArgs e) 
{
    if(ButtonClick != null)
        ButtonClick(this, e);
}

obj.ButtonClick += (Sender, e) => 
{
    splitContainer1.Panel2.Visible = false;
};

Also check this question for more information: Hide/Show Windows Forms panel in C#

emmademontford
  • 122
  • 1
  • 11