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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:35:29+00:00 2026-06-06T22:35:29+00:00

I made an application that passes trough an XML file and extracts the entries

  • 0

I made an application that passes trough an XML file and “extracts” the entries that have a specific value of a certain attribute. The application works fine, but the XML file has over 52,000 entries and only 3 values to sort by (so naturally it takes some time to execute it). Because of that I want to implement a progress bar so I can follow the progress my application made. I googled it, but none of the solutions work for me (the application does it’s work, but the progress bar doesn’t move at all), so if you could help me that would be grate.

The code that extracts the entries is this:

XmlNodeList nodes;
string ExtractedXML = "";

private void extractingXMLToolStripMenuItem_Click(object sender, EventArgs e)
{
    if (nodes.Count != 0)
    {
        foreach (XmlNode node in nodes)
        {
            if (String.Compare(node.ChildNodes[6].ChildNodes[0].Attributes.GetNamedItem("code").Value.ToString(), "CodeValue") == 0)
            {
                tempXML = node.InnerXml;
                temp = "<" + node.Name + " code=\"" + node.Attributes.GetNamedItem("code").Value + "\">" + Environment.NewLine;
                temp += tempXML + Environment.NewLine;
                temp += "</" + node.Name + ">";
                ExtractedXML += temp + Environment.NewLine;
                temp = ""; 
            }
        }
        textBox1.Text = ExtractedXML;
    }
}

There is a ToolStripMenue item for each value with similar code, only the “CodeValue” changes. How can I implement the progress bar to show me how far did the application get?

  • 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-06T22:35:32+00:00Added an answer on June 6, 2026 at 10:35 pm

    You should do your long running process inside of a separate thread, BackgroundWorker would be useful here. When kicking off your process call:

    bgWorker.RunWorkerAsync(//pass in object to process)
    

    Then have a ReportProgress event where you increment your progress bar e.g.

    private void bgWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
            progressBar.Value = e.ProgressPercentage;
    }
    

    And finally, inside of the do work event you’ll want to call report progress with your formula for getting the percentage completed, as well as passing in a processed result, here’s an example i’ve used:

    private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
    {
            bgWorker.ReportProgress((outputGrid.Rows.Count * 100) / importGrid.Rows.Count, result);   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a java application that stores data from a .csv file to
I have made an application that gives the user the option to open up
I have made a web application that uses master page for Login & Logout
I have an application that needs to determine whether a user has made a
I have made a build system for my web application that's rewriting all resource
I have a web application made with Spring that runs on Tomcat. On the
I made an AIR application that parses some specific files. I am using flex
I have made an application that copy the vb components to the system32 folder
I've made an application that makes full use of ajax, and what I need
I made a SmartDevice application that runs on startup and I want it to

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.