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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:57:04+00:00 2026-06-14T20:57:04+00:00

I have written a user control using C# Winforms. In the user control, I

  • 0

I have written a user control using C# Winforms. In the user control, I have three textboxes:

  • txtStartNumber – input is of type: int.
  • txtEndNumber – input is of type: int.
  • txtQuantity – iput is of type: int. (value = txtEndNumber – txtStartNumber)

The progress bar denotes the no. of records added to the database and its total range is set to be equal to txtQuantity.

When one or more records are duplicate, the progress bar is stopped.

My questions are:

  1. How to set the initial value of the progress bar?
  2. How to manage the progress shown by progress bar?

How I save it to the database:

for (long i = from; i < to; i++)
{
    for (int j = 0; j < (to - from); j++)
    {
        arrCardNum[j] = from + j;
        string r = arrCardNum[j].ToString();
        try
        {
            sp.SaveCards(r, 2, card_Type_ID, SaveDate, 2);
            progressBar1.Value = j;
        }
    }
}
  • 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-14T20:57:06+00:00Added an answer on June 14, 2026 at 8:57 pm

    Try this:

    private void StartBackgroundWork() {
        if (Application.RenderWithVisualStyles)
            progressBar.Style = ProgressBarStyle.Marquee;
        else {
            progressBar.Style = ProgressBarStyle.Continuous;
            progressBar.Maximum = 100;
            progressBar.Value = 0;
            timer.Enabled = true;
        }
        backgroundWorker.RunWorkerAsync();
    }
    
    private void timer_Tick(object sender, EventArgs e) {
        progressBar.Value += 5;
        if (progressBar.Value > 120)
            progressBar.Value = 0;
    }
    

    The Marquee style requires VisualStyles to be enabled, but it continuously scrolls on its own without needing to be updated. I use that for database operations that don’t report their progress.

    Here is another Progress Bar Tutorial

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

Sidebar

Related Questions

I have written a simple jQuery.ajax function which loads a user control from the
I have previously written user interfaces using .NET and Windows Forms. I'm about to
I am using php and i have written codes to allow a user upload
We are facing a strange problem. We have a user control written in WPF
I am working in a C# winforms project and I have a user control
I have written a user control that contains a text box and a button.
I have written an application (using Delphi 2009) that allows a user to select
I have written a function which warn a user before refreshing the (I require
i have written insert query for my application to create new user with password,
I have written this code what it does is if user types postcode or

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.