whoone
whoone

Reputation: 533

Easiest way to make ToolStripMenuItem.Selected = true

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

Answers (1)

user7116
user7116

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

Related Questions