Link to home
Start Free TrialLog in
Avatar of frobalompires
frobalompires

asked on

ToolStrip Menu click

Hi experts,

Wend I click in submenu dropdown list item on a toolstrip menu I need to retrieve the parent button name and the clik button name as well.

Im able to get the clicked item name but I need as well the parent item name, how cold I get this.

The items that I show on dropdown list are a loop that I made to a folder to get all the files in that folder.

These items in the edit button are the same on the select button, thats the reason why I need the parent button name, so I can take the correct action.

Ex.:
Suppose I mouse over Edit then will show all my files, wend I click in one I need to know if the file is to edit or select.

Check the img.


img.jpg
Avatar of UnifiedIS
UnifiedIS

You can loop through the dropdownitems collection of each of your parent menu items and look for a match with the name of the clicked item.

Here's a simple method that you'd call within the click event of your child items
Private Function Blah(ByVal ClickedItemName As String) As String
        For Each ddi As ToolStripDropDownItem In Me.EditToolStripMenuItem1.DropDownItems
            If ddi.Name = ClickedItemName Then
                'do something found the match by name
            End If
        Next
End Function

Another method would be to add a value to the tag property of your child items that gave you the information you need.  


Avatar of frobalompires

ASKER

Sry, i can't understand...

This function as to be cal wend i click in sub menu item correct???

If yes, thens is impossible because the sub menu is populate by code and i don't know the button name to invocate the function.
End this sub menu cold have 1 item or 1000....

If not then try to explain me

Regards,  
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial