How to change the checked state of a ToolStripItem in Winforms?

16,599

You need to cast to ToolStripMenuItem:

((ToolStripMenuItem)menuItem).Checked = true;
Share:
16,599

Related videos on Youtube

Joan Venge
Author by

Joan Venge

Professional hitman.

Updated on June 04, 2022

Comments

  • Joan Venge
    Joan Venge almost 2 years

    When I look it up, they list it as having a .Checked property. But both in Visual Studio and on msdn, it doesn't list any kid of Checked property.

    ContextMenuStrip menu = new ContextMenuStrip ( );
    var menuItem = menu.Items.Add ( "CheckedItem" );
    //menuItem.Checked?
    

    Is there a way to do this?