I have a menustrip with several levels of submenus as in below

Client 1
Project 1
Project 1 Task 1
Project 1 Task 2
Project 2
Project 2 Task 1
Project 2 Task 2

Each entry is clickable, even if it has children. In the above example, I can select the Project 2 menu item.

My problem is that when I hover over Project 2, it automatically expands Project 2 Task 1 and Project 2 Task 2. When I click on Project 2 Task 1, the menu "closes up" and all entries disappear which is what I want. However, when I click Project 2, the menu does not "close up" and all of the entries are still visible.

Is there a way to force the menustrip to close back up?

Recommended Answers

All 2 Replies

Member Avatar

Call the item owner's Hide method. Assuming your Project 2 item above is named Project2ToolStripMenuItem then:

Private Sub Project2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Project2ToolStripMenuItem.Click
End Sub

Worked great. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.