Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm useing some code, to show few files at a specified path with a menuitems. So this code has a for each filename in dirname loop and it's useing MenuItem5.MenuItems.Add(filename) to list those files.

 

and the problem is with handling the event of click at the menuitem of a specified filename. There is no event of Menuitem5, which will corespond with MenuItem5's child clicked.

 

How can I solve this problem, Have You got any ideas?

 

thank You any sugestions.

 

Piotrek

  • Leaders
Posted

here's how i'd handle the event , you can add more handlers as you go along :

   Dim obj As MenuItem

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       obj = MenuItem1.MenuItems.Add("some text")
       AddHandler obj.Click, AddressOf item1_Click
   End Sub

   Public Sub item1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
       MsgBox(sender.text)
   End Sub

hope it helps.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...