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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:56:50+00:00 2026-06-12T20:56:50+00:00

I simply want a nondeterministic progressbar that becomes visible and shows some activity to

  • 0

I simply want a nondeterministic progressbar that becomes visible and shows some “activity” to indicate a query is running, and then, when the query is through, goes back to being invisible. Seems simple enough; but with this code:

try
{
    Cursor.Current = Cursors.WaitCursor;
    progressBarChanges.Value = 50;
    progressBarChanges.Step = 20;
    progressBarChanges.Visible = true;
    ... // the meat of the code, where the query is being done, elided
} finally
{
    progressBarChanges.Visible = false;
    Cursor.Current = Cursors.Default;
}

…the progress bar never displays, even though the query takes awhile to run. The progress bar is on a DGV. I realize my progress code is a bit lame, but first things first – I just want the darned thing to show something for starters.

UPDATE

I am setting the progressBar to visible way before I’m calling the BackgroundWorker proc that runs the query:

progressBarChanges.Value = 50;
progressBarChanges.Step = 20;
progressBarChanges.Visible = true;
. . .    
if (args.KeyCode == Keys.Enter)
{
    if (ValidEntryForCRID(textBoxID.Text))
    {
        RetrieveAndBindPlatypusData();
        var tb = (TextBox)Controls.Find("textBoxDuckbill", true).First();
        if (tb != null)
        {
            tb.Focus(); 
        }
        if ((!string.IsNullOrWhiteSpace(textBoxID.Text)) &&
            (backgroundWorkerShowChanges.IsBusy != true))
        {
            backgroundWorkerShowChanges.RunWorkerAsync();
        }
    . . .

…yet the progressBar is never becoming visible (unless I never set it back to visible = false after the DGV’s DataSource is assigned the OracleDateTable value of the returned query/result set). If I comment that out, it then (belatedly) finally shows up, apparently thinking (erroneously) “better late than never.”

Is there a way to force Windows to “pay attention” to the “progressBarChanges.Visible = true;” line right away? Something like a .ProcessMessages() or this.Refresh or…???

  • 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-12T20:56:51+00:00Added an answer on June 12, 2026 at 8:56 pm

    This is how I got it to work:

    I enable the ProgressBar just before the BackgroundWorker call:

    progressBarChanges.Visible = true;
    backgroundWorkerShowChanges.RunWorkerAsync();
    

    The BackgroundWorker code gets the OracleDataTable from the DB:

    private void backgroundWorkerShowChanges_DoWork(object sender, System.ComponentModel.DoWorkEventArgs args)
    {
        holdChanges = GetChangesMade(textBoxID.Text);
    }
    

    The BackgroundWorker’s “completed” event updates the UI:

    private void backgroundWorkerShowChanges_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs args)
    {
        PopulateChangesGrid();
    }
    

    In PopulateChangesGrid(), after assigning the OracleDataTable object to the DGV, I set the Progress bar invisible:

    private void PopulateChangesGrid()
    {
        dgvPlatypi.DataSource = holdChanges;
        progressBarChanges.Visible = false;
    }
    

    It works like a charm (<– not necessarily a reference to Windows 8 “Metro” charms).

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

Sidebar

Related Questions

I simply want to write some code that makes use of recursion of functions
I simply want to edit some commits with git rebase -i HEAD~2 inside the
I simply want to show off a model in a table that is paginated
I simply want to generate a class with attributes that comes from a Database
I have several sql queries that I simply want to fire at the database.
I simply want to create a fairly basic REST service, so that I can
I simply want a stored procedure that calculates a unique id (that is separate
I simply want some tabbing functionality on a facebook application (business) tabs I have
I simply want a class that does this: class cleanup : boost::noncopyable { public:
I simply want to install MySQL on my Mac (running Mac OS X 10.6.5 (Snow Leopard)) for

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.