문제

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