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 8723469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:38:06+00:00 2026-06-13T07:38:06+00:00

I have dynamically added a few items to my Menu Strip and triggered and

  • 0

I have dynamically added a few items to my Menu Strip and triggered and event for each item added to the strip (items are added from an XML file).
What I’m trying to do next is to pass the text from each item to the event handler so I can use them in a thread. Is it possible to this? Can anyone help me with a solution please?

This is my code:

private void historyMenuItem_Click(object sender, EventArgs e){
    XmlDocument doc = new XmlDocument();  // create new xml document
    doc.Load("..\\history.xml");  // load the xml
    // create a new node list
    // and select nodes from BookItems/Book
    XmlNodeList nodeList = doc.SelectNodes("URLs/http"); 

    historyMenuItem.DropDownItems.Clear();
    foreach (XmlNode node in nodeList) {
        string page = node.Attributes["page"].Value;
        //http://msdn.microsoft.com/en-us/library/ms160990.aspx
        ToolStripMenuItem windowNewMenu = new ToolStripMenuItem(page, null, new EventHandler(MenuItemClickHandler));
        historyMenuItem.DropDownItems.Add(windowNewMenu);
    }
}

private void MenuItemClickHandler(object sender, EventArgs e){
    ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
    ## HERE IS WHERE I NEED HELP:
    UrlTextBox = (I need value of page here!);
    this.thread = new Thread(new ThreadStart(this.httpRequestMultiThread));
    this.thread.Start();
}
  • 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-13T07:38:08+00:00Added an answer on June 13, 2026 at 7:38 am

    I would suggest you to use Tag Property. It is object so you need to know to which type to cast it when you want to use it. Something like this

    private void historyMenuItem_Click(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();  // create new xml document
            doc.Load("..\\history.xml");  // load the xml
            XmlNodeList nodeList = doc.SelectNodes("URLs/http");  // create a new node list
                                                                  // and select nodes from BookItems/Book
            historyMenuItem.DropDownItems.Clear();
            foreach (XmlNode node in nodeList)   // for each node in the node list
            {
                string page = node.Attributes["page"].Value;
    
                ToolStripMenuItem windowNewMenu = new ToolStripMenuItem(page, null, new EventHandler(MenuItemClickHandler));
                windowMenuItem.Tag = page;
                historyMenuItem.DropDownItems.Add(windowNewMenu);
            }
        }
    private void MenuItemClickHandler(object sender, EventArgs e)
    {
        ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
    
        UrlTextBox.Text = (string)clickedItem.Tag;
        this.thread = new Thread(new ThreadStart(this.httpRequestMultiThread));
        this.thread.Start();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code $(.delete2).click(function() { $('#load2').fadeIn(); } I have dynamically added item via
i have a li tag which was dynamically added. To that based on some
I have a table. Some rows are dynamically added by jquery. The first <td>
I have the following element on my page, which gets a dynamically added ID
I have created jframe in which jpanels are added dynamically what i can't do
I have TabControl. I added it to tabpages. To one of them(tpTags) I dynamically
I have the following problem spanning dynamically added rows to a TableLayout inside a
I have a folder with a few images, these images are added by user
Friends, i have a xml file including a Sliding drawer. I setContentView in the
I dynamically load in a few li's that have a label and a checkbox

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.