C# ships with a container component called TabControl. As you might expect, this represents a container that can have several tabs, and each tab has its own contents — switching tabs shows the content for that tab.
So how exactly does this work?
When you drag and drop a
TabControl onto a form, you’ll notice a property called
TabPages. Clicking the
[...] icon shows a bunch of members on the left, and their properties on the right.
Don’t be alarmed! For each tab that you add, Visual Studio also creates a TabPage corresponding to that tab — so the first tab has an instance variable called
tabPage1, the next is
tabPage2, and so on. So go ahead and add all the tabs you want, and specify the display text under the Text property. (You may also want to change the names to reflect which tab the page displays content for.)
When that’s done, to add content to a specific tab, simply click on the tab, and drag/drop the relevant control into the tab content area.
Run your application, and viola! Just like at design-time, clicking tabs changes the tab area content. This really showcases the usefulness and power of the IDE.