469,338 Members | 8,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

MenuStrip in Windows Form (C#)

Atran
319 100+
Hello:
I have a MenuStrip in my form, so I add a ToolStripMenuItem to the MenuStrip.
The ToolStripMenuItem has a checkBox.
-------------------------------------------------------------
Now, The ToolStripMenuItem is checked.
I want: When I click The ToolStripMenuItem, The ToolStripMenuItem be unchecked, and when I back again and click The ToolStripMenuItem, The ToolStripMenuItem be checked.
I try this code, but doesnt work:
Expand|Select|Wrap|Line Numbers
  1. private void ToolStripMenuItem_Click(object sender, EventArgs e)
  2.         {
  3.             if (ToolStripMenuItem.Checked.Equals(true) == true)
  4.             {
  5.                 ToolStripMenuItem.Checked.Equals(false);
  6.             }
  7.             if (ToolStripMenuItem.Checked.Equals(false) == true)
  8.             {
  9.                 ToolStripMenuItem.Checked.Equals(true);
  10.             }
  11.         }
  12.  
Thanks................
Jun 12 '07 #1
3 8340
Plater
7,872 Expert 4TB
There is a property you can set to have this done automatically CheckOnClick
Jun 12 '07 #2
TRScheel
638 Expert 512MB
On an aside, couldnt you just write:

Expand|Select|Wrap|Line Numbers
  1. ToolStripMenuItem.Checked = !ToolStripMenuItem.Checked;
Jun 12 '07 #3
Atran
319 100+
Thanks to you all................
Jun 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by John J. Hughes II | last post: by
reply views Thread by genojoe | last post: by
1 post views Thread by genojoe | last post: by
1 post views Thread by Schwammkopf | last post: by
3 posts views Thread by Gav | last post: by
1 post views Thread by Tony Johansson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.