How to: Add Items to Windows Forms DomainUpDown Controls Programmatically


You can add items to the Windows Forms DomainUpDown control in code. Call the Add or Insert method of the DomainUpDown.DomainUpDownItemCollection class to add items to the control's Items property. The Add method adds an item to the end of a collection, while the Insert method adds an item at a specified position.

To add a new item

  1. Use the Add method to add an item to the end of the list of items.



  2. Use the Insert method to insert an item into the list at a specified position.

    // Inserts an item at the third position in the list
    domainUpDown1.Items.Insert(2, "rice");