Selecting default item from Combobox C#

前端 未结 7 852
灰色年华
灰色年华 2021-01-03 18:25

I have few items on my ComboBox items collection, and i\'d like to select one item from this list and set it as default item - when app starts - this item is al

7条回答
  •  抹茶落季
    2021-01-03 18:52

    Remember that collections in C# are zero-based (in other words, the first item in a collection is at position zero). If you have two items in your list, and you want to select the last item, use SelectedIndex = 1.

提交回复
热议问题