HOW TO:以程式設計的方式將項目加入至 Windows Form DomainUpDown 控制項
您可以在程式碼中將項目加入至 Windows Form DomainUpDown 控制項。 呼叫 DomainUpDown.DomainUpDownItemCollection 類別的 Add 或 Insert 方法,將項目加入控制項的 Items 屬性。 Add 方法會將項目加入至集合的尾端,而 Insert 方法則會將項目加入指定的位置。
若要加入新項目
使用 Add 方法將項目加入至項目清單的尾端。
DomainUpDown1.Items.Add("noodles")
domainUpDown1.Items.Add("noodles");
domainUpDown1.get_Items().Add("noodles");
domainUpDown1->Items->Add("noodles");
-或-
使用 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.get_Items().Insert(2, "rice");
// Inserts an item at the third position in the list domainUpDown1->Items->Insert(2, "rice");
請參閱
參考
DomainUpDown 控制項概觀 (Windows Form)
DomainUpDown.DomainUpDownItemCollection.Add