I am calling the following on ToolStripMenu item click :

protected void windowNewMenu_Click(object sender, EventArgs e)
    {
     if (_selectedThings.Contains(((ToolStripMenuItem)sender).Tag))
     {
        selectedItemsPropertyGrid.SelectedObject = ((ToolStripMenuItem)sender).Tag;
        selectedItemsComboBox.SelectedText = (((ToolStripMenuItem)sender).Tag.GetType()).ToString();
     }
    }

However the second line that is supposed to change does not seem to produce any visible changes to the ComboBox. Any Suggestions?

有帮助吗?

解决方案

SelectedText is for highlighting a portion of the text, not selecting an item in the list. For that, you need SelectedItem.

Or you can just use:

selectedItemsComboBox.Text = ...
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top