JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Getting the Number of Items in a Combo Box

You're trying to bend over backwards to make your program user-friendly and have let the user add items to the main combo box. But now you need to see if they've added a particular item to the combo box—how do you find out how many items there are in the combo box currently so you can set up your loop?

No problem; you can get the number of items in a combo box with the Items.Count property like this:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    MsgBox("The combo box contains " & ComboBox1.Items.Count & " items.")
End Sub
Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor 
pure cambogia ultra