Bagikan melalui


How to: Remove Items from Windows Forms DomainUpDown Controls

You can remove items from the Windows Forms DomainUpDown control by calling the Remove or RemoveAt method of the DomainUpDown.DomainUpDownItemCollection class. The Remove method removes a specific item, while the RemoveAt method removes an item by its position.

To remove an item

  • Use the Remove method of the DomainUpDown.DomainUpDownItemCollection class to remove an item by name.

    DomainUpDown1.Items.Remove("noodles")
    
    domainUpDown1.Items.Remove("noodles");
    
    domainUpDown1->Items->Remove("noodles");
    

    -or-

  • Use the RemoveAt method to remove an item by its position.

    ' Removes the first item in the list.
    DomainUpDown1.Items.RemoveAt(0)
    
    // Removes the first item in the list.
    domainUpDown1.Items.RemoveAt(0);
    
    // Removes the first item in the list.
    domainUpDown1->Items->RemoveAt(0);
    

See Also

Reference

DomainUpDown Control Overview (Windows Forms)

DomainUpDown

DomainUpDown.DomainUpDownItemCollection.Remove

DomainUpDown.DomainUpDownItemCollection.RemoveAt

Other Resources

DomainUpDown Control (Windows Forms)