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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:13:50+00:00 2026-05-17T21:13:50+00:00

I am designing a form in which I have to increase a Progress bar

  • 0

I am designing a form in which I have to increase a Progress bar while an operation is being performed simultaneously (In other words, I am showing the progress of this operation).
This operation takes 50 seconds. So I have used a System.Timer to Increase the Progress bar.

There isn’t a single thread in my code. When I write Progress_bar.PerformStep() in Timer Event Handler, it gives error as “Cross Thread Operation Not Valid”.

[From this error I analyzed that System.Timer must be creating a Thread and Runs the timer in it to perform multiple tasks.]

What should I do to increase my progress bar after every Second?

I tried solution given in this question. It removed the error but Now I can’t see the progress bar increasing. Means it Starts…. No Increase for 50 sec and after it 100%.

Code is as follows:

Timer Declaration (It is Global):

public System.Timers.Timer Thetimer = new System.Timers.Timer(1000);

Event Declaration (This is in Constructor to make it…err…Public [May not be a correct word]):

Thetimer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);

Call:

 Thetimer.Start();

 blRetVal = FunctionToBeExecuted(parameter);

 Thetimer.Stop();

Event Handler:

 void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
           //StatusBar.PerformStep();  -- Tried This. It gives the Error

/* This doesn't give an error but Another issue Arises */

            if (InvokeRequired)
            {
                BeginInvoke(new Action(StatusBar.PerformStep));

            }
            else
                StatusBar.PerformStep();
        }

P.S. I am using C# and Visual Studio 2008

  • 1 1 Answer
  • 3 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-17T21:13:51+00:00Added an answer on May 17, 2026 at 9:13 pm

    It sounds like you’re performing your “background” operation on the main thread, which is why your progress bar doesn’t update when you invoke it.

    Have a look at BackgroundWorker.

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

Sidebar

Related Questions

I am designing a database app, and have a form which populates with data
We are designing an online application (college admission form) which mandates the user to
When designing a form I have the option of putting a close button at
I'm designing a form with a horizontal scroll bar docked at the bottom. I
Well,i have a weird question to ask,sometimes when designing a form and using lots
I have a form in which the user can either select from a pre-existing
I'm designing a C# application where I have a groupbox showing OS and RAM
im designing a way the form posts its data. e.g if we have a
i am new to symfony2. I am designing a dynamic form builder. I have
I am designing a silverlight application in which i have a image control in

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.