Export (0) Print
Expand All

Adding Items to Windows Forms DomainUpDown Controls Programmatically

Visual Studio .NET 2003

You can add items to the Windows Forms DomainUpDown control in code. Call the Add or Insert method of the 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

  • Use the Add method to add an item to the end of the list of items.
    ' Visual Basic
    DomainUpDown1.Items.Add("noodles")
    
    // C#
    domainUpDown1.Items.Add("noodles");
    
    // C++
    domainUpDown1->Items->Add(S"noodles");
    

    -or-

  • Use the Insert method to insert an item into the list at a specified position.
    ' Visual Basic
    ' Inserts an item at the third position in the list
    DomainUpDown1.Items.Insert(2, "rice")
    
    // C#
    // Inserts an item at the third position in the list
    domainUpDown1.Items.Insert(2, "rice");
    
    // C++
    // Inserts an item at the third position in the list
    domainUpDown1->Items->Insert(2, S"rice");
    

See Also

DomainUpDown Control (Windows Forms) | Introduction to the Windows Forms DomainUpDown Control | DomainUpDown Class | DomainUpDown.DomainUpDownItemCollection.Add Method | ArrayList.Insert Method

Show:
© 2014 Microsoft