Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the number of items in a combobox?

Tags:

How can I get the number of items listed in a combobox?

like image 509
Ivan Prodanov Avatar asked Apr 20 '09 14:04

Ivan Prodanov


People also ask

What gets the number of items in the JComboBox?

setModel(ComboBoxModel a) : sets the data model that the JComboBox uses to obtain the list of items. setMaximumRowCount(int count): sets the maximum number of rows the JComboBox displays.

Which method is used to add the items in a ComboBox?

To add a set of items to the combo box it is best to use the AddRange method. If you choose to use the Add method to add a number of items to the combo box, use the BeginUpdate method to suspend repainting during your add and the EndUpdate method to resume repainting.


1 Answers

Try

var count = comboBox.Items.Count; 
like image 119
JaredPar Avatar answered Sep 23 '22 19:09

JaredPar