Q:

How do I dynamically change groupboxes on button click?

I'm creating an application on Visual Studio 2012 (c#/Winforms).
What exactly i have in mind is depicted by the image: 
When Button1 is clicked the content within the groupbox will change, same with button 2 & 3.
I'm currently using the following: 
private void button2_Click(object sender, EventArgs e)
{
    this.Controls.Remove(this.groupBox1);
    this.Controls.Add(this.groupBox2);
}

My Questions are: 
a) By using this, will runtime performance will be hampered as all controls will be active(though hidden) at the same time?
b) Consider I continue to using the current method, Can I create a new workspace and build each groupbox in different windows?
c) Is there are workaround to my current method?
Thanks.

A:

Better would be just:
private void button2_Click(object sender, EventArgs e)
{
    groupbox2.Visible = true;
    groupbox1.Visible = !groupbox2.Visible;
}

and similarly
private void button1_Click(object sender, EventArgs e)
{
    groupbox1.Visible = true;
    groupbox2.Visible = !groupbox1.Visible;
    groupbox3..... = !groupbox1.Visible; //etc
}

This will be more performant, and also adding and removing controls can have side effects with complex guis where controls wont get positioned properly.
To answer you:
a) Not much, but as I said its better to toggle the visibility.
b) What is a workspace? Of course you can ahead with your approach from any window or form. But if you are adding groupboxes of one form to another, then groupboxes from the first form will be removed.
c) My answer..

