Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:35:55+00:00 2026-06-05T15:35:55+00:00

How can you add a click event to dynamically created menu item? I thought

  • 0

How can you add a click event to dynamically created menu item?

I thought I could do something like

Loop through all the items in the Menu1.DropDownItems then create a mousedown even on the item and execute an action based off that.

I’m new to VB and was wondering what logic to use. Will that even work? How will the events be saved through the life of the application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:35:57+00:00Added an answer on June 5, 2026 at 3:35 pm

    You will have to have a method that fits the event’s signature. Then, when creating the MenuItem, you can add a handler to the event:

    Dim item As New MenuItem(...)
    '...
    AddHandler item.Click, AddressOf myEventHandler
    
    Sub myEventHandler(sender As Object, e As System.EventArgs)
        'Do something
    End Sub
    

    You cannot create an event in a class that you don’t have access to. The only option would be to derive from it, but this works only in some cases. In case of the MenuItem, this is not even necessary, because it already provides a Click event. You just have to add a handler for it. The handler is saved in the item’s event, which maintains a kind of list of handlers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add click event to newly added item of menu? Below is
how can i add a custom view to the right click menu of every
i'm setting a click event on a div that is dynamically created in a
how we can add click event to highchart from chart object that we get
When I go to Printers and Faxes dialog, I can click the Add a
I can add a Conditional statement to a breakpoint, for instance arg0.startsWith(something) but i'd
Can someone please direct me on how I can add something similar to inputAccessoryView
I'm trying to make something where you can dynamically insert an HTML block, and
Using Titanium Appcelerator I am trying to dynamically create elements and add event listeners
The idea is user can click a button Add Country, Country picker will come

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.