ComboBox.Items Property
Gets an object representing the collection of the items contained in this ComboBox.
[Visual Basic] Public ReadOnly Property Items As ComboBox.ObjectCollection [C#] public ComboBox.ObjectCollection Items {get;} [C++] public: __property ComboBox.ObjectCollection* get_Items(); [JScript] public function get Items() : ComboBox.ObjectCollection;
Property Value
A System.Windows.Forms.ComboBox.ObjectCollection representing the items in the ComboBox.
Remarks
This property enables you to obtain a reference to the list of items that are currently stored in the ComboBox. With this reference, you can add items, remove items, and obtain a count of the items in the collection. For more information on the tasks that can be performed with the item collection, see the System.Windows.Forms.ComboBox.ObjectCollection class reference topics.
Example
[Visual Basic] Private Sub addButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) comboBox1.Items.Add(textBox1.Text) End Sub [C#] private void addButton_Click(object sender, System.EventArgs e) { comboBox1.Items.Add(textBox1.Text); } [C++] private: void addButton_Click(Object* /*sender*/, System::EventArgs* /*e*/) { comboBox1->Items->Add(textBox1->Text); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
ComboBox Class | ComboBox Members | System.Windows.Forms Namespace