Ivan Prodanov
Ivan Prodanov

Reputation: 35532

How to get the number of items in a combobox?

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

Upvotes: 22

Views: 90508

Answers (4)

Variable_name_JComboBox.getComponentCount()

Upvotes: 0

Lucie Vallaude
Lucie Vallaude

Reputation: 1

comboBox.Items.Count;

Doesn't work for me.

I use :

comboBox->count();

Upvotes: 0

Jeff Yates
Jeff Yates

Reputation: 62397

You should reference Count of the Items property.

myComboBox.Items.Count

Upvotes: 21

JaredPar
JaredPar

Reputation: 755317

Try

var count = comboBox.Items.Count;

Upvotes: 42

Related Questions