存取 Windows Forms 下拉式方塊、清單方塊或已核取清單方塊中的特定項目是一項基本工作。 它可讓您以程式設計方式判斷清單中位於任何指定位置的內容。
存取特定項目
使用特定項目的索引查詢
Items集合:Private Function GetItemText(i As Integer) As String ' Return the text of the item using the index: Return ComboBox1.Items(i).ToString End Functionprivate string GetItemText(int i) { // Return the text of the item using the index: return (comboBox1.Items[i].ToString()); }private: String^ GetItemText(int i) { // Return the text of the item using the index: return (comboBox1->Items->Item[i]->ToString()); }