开发者

Visual Basic 2008 | How to Check only One MenuStrip Item at a Time

Good morning everyone!

I have a Menustrip in Visual Basic 2008.

My question is how do I check only one menu item at a time?

Lets assumed I have a MenuScript that is titled Fruits.

When you click on Fruits, you get a drop down of four fruits.

Apples, Orange, Bananas and Mango.

If you click on a fruit there is a check mark indicating that item is either active or that the item was click. This is called CheckOnClick.

The problem is I only need the check mark on one item at a time. So if I check Apples and decide to check orange, then Apples should uncheck and Orange should have the check mark.

开发者_C百科Currently, if I check apples and check orange, both items will have check marks.

I need to have only one item check at a time.

I do not have access to my code at the moment, so please bear with me.

Thanks every one!

Novice


Link to MSDN

http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.checked.aspx

Alternatively:

On menu item click event - parse through all menu items and set selected property = false. set selected property = true for selected menu item.

hope that helps


' First set all to false.

for each item in toolstripitem.dropdownitems
   item.checked = False
next

' Then check what you want.

toolstriptemcolor1.checked = true
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜