Visual Basic .NET » Visual Basic .NET General Discussion
PRoblem with events -- Very_NewBie --


Hi, i'm new in this group ^_^
I'm newbie in VB .NET but I hope you'll can help me. I have declared a dynamic vector of MenuItem:
Dim Item_menu As MenuItem()

This Item_menu assumes a variable number of MenuItem...then these item are associated on a ContextMenu object.
But, how can I handle Click event when a user click on a ContextMenu elements and know which element has been selected?

Thanks

-- Cerebrus --


errr... Not to sound ignorant, but what in God's name is a "dynamic vector" ? ;-)

I think you're talking about an array of MenuItems.
The Click event has a sender parameter that will tell you the item that generated the event. It is of type Object. You can cast it to MenuItem to get the array member which was clicked. Depending on that, you can execute the relevant actions.

[Submit Comment]Home