다음을 통해 공유


방법: 프로그래밍 방식으로 Windows Forms DomainUpDown 컨트롤에 항목 추가

코드에서 Windows Forms DomainUpDown 컨트롤에 항목을 추가할 수 있습니다. DomainUpDown.DomainUpDownItemCollection 클래스의 Add 또는 Insert 메서드를 호출하여 컨트롤의 Items 속성에 항목을 추가합니다. Add 메서드는 컬렉션의 끝에 항목을 추가하는 반면 Insert 메서드는 지정된 위치에 항목을 추가합니다.

새 항목을 추가하려면

  1. Add 메서드를 사용하여 항목 목록의 끝에 항목을 추가합니다.

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

    또는

  2. Insert 메서드를 사용하여 지정된 위치의 목록에 항목을 삽입합니다.

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

참고 항목