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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:23:00+00:00 2026-05-23T04:23:00+00:00

I am developing winform(c#) that start/stop/restart windows services. I want to put a progress

  • 0

I am developing winform(c#) that start/stop/restart windows services. I want to put a progress bar till the action is completed. I am new to .net programming. Kindly help me on to achieve this.

  • 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-05-23T04:23:01+00:00Added an answer on May 23, 2026 at 4:23 am

    You cannot show meaningful progress when you don’t know how long it takes. You can’t know, services take anywhere from 1 to 30 seconds to start. All you can do is show a “I’m not dead, working on it” indicator to the user. ProgressBar supports that, set the Style property to “Marquee”.

    You’ll also need to start the service in a worker thread to avoid your UI from freezing. That’s best done with a BackgroundWorker. Make it look similar to this:

    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            ServiceProgressBar.Style = ProgressBarStyle.Marquee;
            ServiceProgressBar.Visible = false;
        }
    
        private void StartButton_Click(object sender, EventArgs e) {
            this.StartButton.Enabled = false;
            this.ServiceProgressBar.Visible = true;
            this.backgroundWorker1.RunWorkerAsync("foo");
        }
    
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
            var ctl = new ServiceController((string)e.Argument);
            ctl.Start();
        }
    
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
            this.StartButton.Enabled = true;
            this.ServiceProgressBar.Visible = false;
            if (e.Error != null) {
                MessageBox.Show(e.Error.ToString(), "Could not start service");
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Windows Mobile WinForm application that uses Sql Server CE 3.1 with
I am developing a winform application. I want to play a sound file, till
Over and over, I find myself developing WinForm business application screens that have a
I have a winforms (VB 2008) based app that I'm developing and I want
I'm developing an winform application for Windows Mobile 5.0 and above. I'm using .Net
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
I'm developing a WinForm app for Windows Mobile 6.0 with C#, .NET Compact Framework
I'm developing a WinForm Windows Mobile 5.0 or above with .Net Compact Framework 2.0
I'm developing a Windows Mobile WinForm app with C# and .Net Compact Framework 2.0
I am currently developing a C# Windows Form Application that I intend to let

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.