Reputation: 533
I have a ToolStripMenuItem
named mailResultsToolStripMenuItem
. Now I want it to be .Selected = true
when users click on it and .Selected = false
when users click it again. I tried:
mailResultsToolStripMenuItem.Selected = true;
but it shows an error that the property is read-only.
Upvotes: 2
Views: 2968
Reputation: 64138
Were you looking for ToolStripMenuItem.Checked
?
// true if the ToolStripMenuItem is checked or is in an indeterminate state;
// otherwise, false. The default is false.
mailResultsToolStripMenuItem.Checked = true;
// Also interesting: mailResultsToolStripMenuItem.CheckState
// mailResultsToolStripMenuItem.CheckOnClick
Upvotes: 1