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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:13:53+00:00 2026-05-14T18:13:53+00:00

I need some help on showing Progress bar upon loading data on my DataGridView.

  • 0

I need some help on showing Progress bar upon loading data on my DataGridView. Any sample code?

Thanks.

regards,

kurt

  • 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-14T18:13:54+00:00Added an answer on May 14, 2026 at 6:13 pm

    Start the fetching of the data on another thread in order to not lock up the UI thread. You could expose a method on the UI (presume you have separation of layers here) and call that method from your business layer. Windows Form controls expose a InvokeRequired flag that you can use to check if you are calling the control from the correct thread. If you are not on the right thread you can call a delegate to do so.

        /// <summary>
        /// Delegate to notify UI thread of worker thread progress.
        /// </summary>
        /// <param name="total">The total to be downloaded.</param>
        /// <param name="downloaded">The amount already downloaded.</param>
        public delegate void UpdateProgressDelegate(int total, int downloaded);
    
        /// <summary>
        /// Updates the progress in a thread-safe manner.
        /// </summary>
        /// <param name="total">The total.</param>
        /// <param name="downloaded">The downloaded.</param>
        public void UpdateProgress(int total, int downloaded)
        {
            // Check we are on the right thread.
            if (!this.InvokeRequired)
            {
                this.ProgressBar.Maximum = total;
                this.ProgressBar.Value = downloaded;
            }
            else
            {
                if (this != null)
                {
                    UpdateProgressDelegate updateProgress = new UpdateProgressDelegate(this.UpdateProgress);
    
                    // Executes a delegate on the thread that owns the control's underlying window handle.
                    this.Invoke(updateProgress, new object[] { total, downloaded });
                }
            }
        }
    

    Or you could just use a BackgroundWoker 😉

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

Sidebar

Related Questions

I need some help with echoing an SQL field but it keeps showing Resource
I need some help in rendering a dynamic gridview. Using the source code below,
Need some help to write a C# code to send mail to multiple users
I need some help,showing a map inside my rails 3.0 pages I fond cartographer
I need some help in using objects from Core Data with GCD; I seem
I need some help with showing images in my portlet. I have images somewhere
I need some help or information with showing the image int the <img> tag
I need some help to figure this out .. I am getting data from
I'm in need of some help with getting my duplicates from showing more than
I need some help with showing/allowing the keyboard to show and input. My basic

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.