Question

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?

Was it helpful?

Solution

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 = ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top