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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:03:21+00:00 2026-06-06T14:03:21+00:00

I have a command line tool written in c# (that i have the source

  • 0

I have a command line tool written in c# (that i have the source of) that I am making a gui for in visual studio 2010. In the gui I want to update the progress bar to reflect the progress of the tools operations. How would I signal from inside the tool that progress has been made and to update the progress bar?
Some simplified example code of what im doing.

private void doThings_Click(object sender, EventArgs e)
{
  myToolInstance.doWorkThatNeedsToReportProgress();
}

The work that is being done by the tool is a series of function calls, normally around 30. I want to update the progress bar each time one of those finishes.

  • 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-06T14:03:22+00:00Added an answer on June 6, 2026 at 2:03 pm

    Create a public property or a public method in the form containing the progress bar

    public void SetProgress(int progress)
    {
        progressBar.Progress = progress;
    }
    

    Now you can update the progress bar with

    myForm.SetProgress(50);
    

    Another approach is to have a ProgressChanged event somewhere and let the form subscribe to this event.

    public class Tool {
        public event Action<int> ProgressChanged;
    
        private void OnProgressChanged(int progress) 
        {
            ProgressChanged?.Invoke(progress);
        }
    
        public void DoSomething()
        {
            ...
            OnProgressChanged(30);
            ...
        }
    }
    

    In the form you would have something like this

    private Tool _tool;
    
    public MyForm () // Constructor of your form
    {
        _tool = new Tool();
        _tool.ProgressChanged += Tool_ProgressChanged;
    }
    
    private void Tool_ProgressChanged(int progress)
    {
        progressBar.Progress = progress;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a tool that is run on the command line. I can
I have written a command-line tool that uses sub-commands much like Mercurial, Git, Subversion
I have a C command line tool written in Xcode that uses the Accelerate
I have a small command-line application written in C that acts as a wrapper/launcher
I have a little command line tool that reads from stdin. On the command
I have read that one could use the class dump command line tool to
I have a binary that's used as a command-line tool to manipulate some files
I've written a command line tool that preprocesses a number of files then compiles
I have a simple .net command line tool written and compiled under Windows, using
I have a Python application (command line tool running on a machine M1) that

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.