Saturday, February 5, 2011

C#: How do you control the current item index that displays in a ComboBox?

I have set a list of items in a combobox, but when I debug the application, I have to select an item from the drop down to display an item by default. Is there a property? that you can set so that the combobox itemindex will always begin at 0 meaning the first item in the list at startup of the application?

  • this.comboBox1.SelectedIndex = 0;
    
    From BFree
  • You are gonna want to use the SelectedIndex attribute.

    The SelectedItem property can only be read. Using the SelectedText and SelectedValue Properties will change the Text and Value not which one is selected

    From jmein

0 comments:

Post a Comment