--- title: Add Items to DomainUpDown Controls Programmatically ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" - "cpp" helpviewer_keywords: - "spin button control [Windows Forms], adding items" - "DomainUpDown control [Windows Forms], adding items to" ms.assetid: fd31d314-33eb-4181-90f8-d32ed0c4e072 --- # How to: Add Items to Windows Forms DomainUpDown Controls Programmatically You can add items to the Windows Forms control in code. Call the or method of the class to add items to the control's property. The method adds an item to the end of a collection, while the method adds an item at a specified position. ### To add a new item 1. Use the method to add an item to the end of the list of items. ```vb DomainUpDown1.Items.Add("noodles") ``` ```csharp domainUpDown1.Items.Add("noodles"); ``` ```cpp domainUpDown1->Items->Add("noodles"); ``` -or- 2. Use the method to insert an item into the list at a specified position. ```vb ' Inserts an item at the third position in the list DomainUpDown1.Items.Insert(2, "rice") ``` ```csharp // Inserts an item at the third position in the list domainUpDown1.Items.Insert(2, "rice"); ``` ```cpp // Inserts an item at the third position in the list domainUpDown1->Items->Insert(2, "rice"); ``` ## See also - - - - [DomainUpDown Control](domainupdown-control-windows-forms.md) - [DomainUpDown Control Overview](domainupdown-control-overview-windows-forms.md)