How to Set default combobox

前端 未结 5 1637
梦谈多话
梦谈多话 2021-02-19 00:48

So I\'ve been looking to set a default value for my combobox. I found a few things but none of them seem to work.

Actually, it works if I create a simple combobox and us

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-19 01:16

    Here's my simple solution

            var list = comboBox1.Items.Cast().ToList();
            cbxCategory.SelectedIndex = list.FindIndex(c => c.StartsWith("test"));
    

提交回复
热议问题