C # display the running status with multiple threads

Source: Internet
Author: User

Processing of large Copy files or network access is suspended. Add a progress bar with multiple threads (only show running, no progress) to indicate running status. Okay, let's just talk about it. The previous example. First look at the result diagram:

Program description:

Click "Button" to run a data accumulator. the textBox displays the result of each operation. ProgressBar indicates the running status.

Okay, paste the Code directly:

01 using System; 02 using System.Collections.Generic; 03 using System.ComponentModel; 04 using System.Data; 05 using System.Drawing; 06 using System.Linq; 07 using System.Text; 08 using System.Windows.Forms; 09 using System.Threading; 10   11 namespace Testpro 12 { 13      public partial class Form1 : Form 14      { 15          BackgroundWorker work = new BackgroundWorker(); 16          public Form1() 17          { 18              InitializeComponent(); 19              work.WorkerReportsProgress = true ; 20              work.DoWork += Count; 21              work.RunWorkerCompleted += completeRun; 22              Control.CheckForIllegalCrossThreadCalls = false ; 23              this .textBox1.ScrollBars = ScrollBars.Both; 24          } 25   26
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.