1. #1

    Help me with Visual Studio 2010 - Need to find max index in a combo box.

    I'm trying to code a project for one of my classes. Trying to finish it up before I have to head to class in about 3 hours.

    I need to figure out how I can pull the item count from a combo box. The user of the program is able to enter and remove values as they use the program, so I can't simply hard code in a value. If a user adds 15 items to a combo box and I need to pull that amount from the combo box to use in code later on, how would I go about doing that?

    There must be a property that returns the count of items or indexes in the combobox, but I can't find it.

    I tried .Items.ListCount -> but thats apparently for access or something, not visual studio.
    I've looked through the list of properties and can't seem to find one that would return the value I need. Im positive there has to be a property for this. Anyone know what it is?

    For reference, I'm basically creating a second form for a summary that displays a list of all the items in the combo box.

  2. #2
    Try:

    myComboBox.Items.Count

    It's been awhile since I've messed with combo boxes though =/

  3. #3
    Quote Originally Posted by Blade and Soul View Post
    Try:

    myComboBox.Items.Count

    It's been awhile since I've messed with combo boxes though =/
    Yea thanks i actually found this and was trying it, it doesn't seem to be working 100% properly. For example, if i try using it with this code:

    totalLabelsLabel.Text = mainForm.myComboBox.Items.Count

    Its not displaying it in the label.

    Edit* Fixed it, the loop statement before the code was looping endlessly, so it wasn't even getting to that code. Works fine, thanks.
    Last edited by Alcsaar; 2013-10-30 at 06:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •