解决方案 »

  1.   

    发现百分比label已经增加到20%的时候,progressBar才开始启动
      

  2.   

    rowRead++;
    pb.Value = (int)rowRead;
    percent = ((float)(100 * rowRead)) / totalCount;
    ll.Text = percent.ToString("0.00").Trim() + "%";
    追踪一下上面三行代码;
    建议去掉long rowRead = 0;    float percent = 0;直接用i .也不要进行浮点转换和计算了,浪费时间,还容易出错
      

  3.   

    设置pb.Step=0;
    Pbar.PerformStep();
    Pbar.Value =(int)rowRead;
      

  4.   

    pb.Value = (int)rowRead;这个不对应该是0~100之间的数字代表进度。
      

  5.   

    应该这样:  rowRead=rowRead+(int)(100/dt.DefaultView.Count);????
      

  6.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void button1_Click(object sender, EventArgs e)
            {
                progressBar1.Maximum=int.Parse(textBox1 .Text );
                for (int i = 0; i < int.Parse(textBox1.Text)+1; i++)
                {
                    progressBar1.Value = i;
                    label1.Text = ((100 * i) / (int.Parse(textBox1.Text))).ToString() + "%";
                    label1.Refresh();
                                }        }
        }
    }
      

  7.   

    用 BackgroundWorker不多好哈,以前我纠结一段时间,后来有网友推荐用,蛮好用的.
      

  8.   

    是,这个无论使用多线程或者其他似乎好点,不太确定是不是Application.DoEvents引起的