---
title: "How to: Add a ToolStripContainer to a Form"
ms.date: "03/30/2017"
dev_langs: 
  - "csharp"
  - "vb"
helpviewer_keywords: 
  - "toolbars [Windows Forms], built-in rafting"
  - "ToolStrip control [Windows Forms], built-in rafting"
  - "ToolStripContainer control [Windows Forms], adding to Windows Forms"
ms.assetid: d0f55095-a833-453e-be5a-644906d75d54
---
# How to: Add a ToolStripContainer to a Form
You can programmatically add a <xref:System.Windows.Forms.ToolStripContainer> to a Windows Form and populate it with controls.  
  
## Example  
 The following code example demonstrates how to add a <xref:System.Windows.Forms.ToolStripContainer> and a <xref:System.Windows.Forms.ToolStrip> to a Windows Forms, how to add items to the <xref:System.Windows.Forms.ToolStrip>, and how to add the <xref:System.Windows.Forms.ToolStrip> to the <xref:System.Windows.Forms.ToolStripContainer.TopToolStripPanel%2A> of the <xref:System.Windows.Forms.ToolStripContainer>.  
  
 [!code-csharp[System.Windows.Forms.ToolStripContainer2#1](~/samples/snippets/csharp/VS_Snippets_Winforms/system.windows.forms.toolstripcontainer2/cs/form1.cs#1)]
 [!code-vb[System.Windows.Forms.ToolStripContainer2#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/system.windows.forms.toolstripcontainer2/vb/form1.vb#1)]  
  
## Compiling the Code  
 This code example requires:  
  
- References to the System.Drawing, System.Text, and System.Windows.Forms assemblies.  
  
## See also

- <xref:System.Windows.Forms.ToolStripContainer>
- [ToolStripContainer Control](toolstripcontainer-control.md)
- [ToolStrip Control](toolstrip-control-windows-forms.md)
