我需要帮助以编程方式在WinForms中更改我的组合框

Coc*_*Dev 2 c# combobox winforms c#-4.0

int item = ComboBox.FindStringExact("Open"); 
    if (item >= 0) 
        ComboBox.SelectedItem = item;
Run Code Online (Sandbox Code Playgroud)

我想在我的组合框中选择项目(以编程方式)选择OPEN

我的代码不起作用,但我将不胜感激任何帮助

Aus*_*nen 5

我相信你想要SelectedIndex而不是SelectedItem(我假设 item >= 0在这里).