473,395 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 8525
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

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

Similar topics

4
by: John J. Hughes II | last post by:
Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of...
0
by: rellik | last post by:
Hi All, I've run into a problem with the MenuStrip control and any help would be greatly appreciated! The problem I've got is that when use a control derived from the MenuStrip class all MDI...
0
by: academic | last post by:
I'm having a problem merging a ContextMenuStrip for a UserControl to the MenuStrip on the form containing the UserControl. I tried the following thinking that it is equivalent to cloning the...
0
by: genojoe | last post by:
Included below are four methods and a Friend that can be inserted directly into a form that already contains Button1, Button2, and MenuStrip1. Button1 populates the MainMenu control, button2...
1
by: genojoe | last post by:
I am converting from MainMenu to MenuStrip And I want to list the hierarchy of a clicked menu item. With the MainMenu, it was easy to do using the parent property of the MenuItem. With the...
1
by: Schwammkopf | last post by:
Hi ! I'm using Visual Studio 2005 Professional Edition and C#. I have a simple question: I want to add to my form, which is a scrollable control, a menustrip and statusstrip. The problem is...
3
by: Gav | last post by:
I am using a MenuStrip on a form and adding a Panel to the same form in the program. When the Panel is added the top of the Panel is behind the MenuStrip, so the top of the Panel is hidden. How do...
0
by: kyungdongkim | last post by:
Hi, I have a dynamically generated MenuStrip following this example: http://www.codeproject.com/useritems/Dynamic_MenuStrip.asp Basically the menu strip allows users to save and load reports. ...
1
by: Tony Johansson | last post by:
Hello! I have a System.Windows.Forms.MenuStrip with some ToolStripMenuItem. One of these ToolStripMenuItem is called saveMemberToolStripMenuItem. This one is defined like this...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.