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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:06:43+00:00 2026-05-26T13:06:43+00:00

I have here a long method that takes a little while to execute. I

  • 0

I have here a long method that takes a little while to execute. I would like to keep the user entertained so I created a progress bar and a label. What I would like is for that label to change while the system executes the progress. Ive been looking at Application.DoEvents(), but it seems like thats the wrong way to go. This application is pretty simple and its just a project and nothing professional. All this app does is send a file to a client and insert the data into a database.

I have one label (besides a success and error label), that I would like to constantly update along side the progress bar. Any ideas or tips on how to do this? Would Application.DoEvents() be acceptable in this situation? Or is there a simple way to update the text. I am using C#, asp.net, and a System.Web.UI.Page. Any help or pointing me to the right direction would be greatly appreciated.

protected void Button_Click(object sender, EventArgs e)
{
    PutFTPButton.Enabled = false;
    Thread.Sleep(3000);
    Button btn = (Button)sender;
    KaplanFTP.BatchFiles bf = new KaplanFTP.BatchFiles();
    KaplanFTP.Transmit transmit = new KaplanFTP.Transmit();
    //label text change here
    if (btn.ID == PutFTPButton.ID)
    {
        //bf.ReadyFilesForTransmission();
        DirectoryInfo dir = new DirectoryInfo(@"C:\Kaplan");

        FileInfo[] BatchFiles = bf.GetBatchFiles(dir);

        bool result = transmit.UploadBatchFilesToFTP(BatchFiles);
        //label text change here
        if (!result)
        {
            ErrorLabel.Text += KaplanFTP.errorMsg;
            return;
        }

        bf.InsertBatchDataIntoDatabase("CTL");
        bf.InsertBatchDataIntoDatabase("HDR");
        bf.InsertBatchDataIntoDatabase("DET");
        bf.InsertBatchDataIntoDatabase("NTS");
        List<FileInfo> allfiles = BatchFiles.ToList<FileInfo>();
        allfiles.AddRange(dir.GetFiles("*.txt"));
        bf.MoveFiles(allfiles);
        //label text change here
        foreach (string order in bf.OrdersSent)
        {
            OrdersSentDiv.Controls.Add(new LiteralControl(order + "<br />"));
        }
        //lblWait.Visible = false;
        OrdersSentDiv.Visible = true;
        OrdersInfoDiv.Visible = false;
        SuccessLabel.Visible = true;
        NoBatchesToProcessLbl.Visible = true;
        BatchesToProcessLbl.Visible = false;
        PutFTPButton.Enabled = false;
        BatchesCreatedLbl.Text = int.Parse(NextBatchNum).ToString();
        Thread.Sleep(20000);

        if (KaplanFTP.errorMsg.Length != 0)
        {
            ErrorLabel.Visible = true;
            SuccessLabel.Visible = false;
            ErrorLabel.Text = KaplanFTP.errorMsg;
        }
    }
}
  • 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-26T13:06:44+00:00Added an answer on May 26, 2026 at 1:06 pm

    I think you can use an Ajax UpdateProgress control, check Progress Bar on File Upload ASP.NET.

    EDIT: Another one Displaying Progress Bar For Long Running Processes using ASP.NET AJAX.

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

Sidebar

Related Questions

Let's say I have a javascript method that takes a little to long to
I have a client/service. The service has a method that takes a long time
I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345
I have these long statements that I will refer to as x,y etc. here.
I have an XML file that is very long, but here is a shot
I'm trying to make a method that takes an argument of Country.class , User.class
i have code that takes a csharp datetime and converts it into a long
I have a method that takes data from a .csv file and puts it
So I have a JavaScript method that is ran after a user selects certain
Probably a long question for a simple solution, but here goes... I have a

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.