namespace progressSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void button1_Click(object sender, EventArgs e)
        {
            int j;
            for (int i = 0; i <= 1000000; i++)
            {
                Math.DivRem(i, 10000, out j);
                if (j == 0)
                {
                    progressBar1.PerformStep();
                }
            }
        }        private void button2_Click(object sender, EventArgs e)
        {
            progressBar1.Value = 0;
        }        private void progressBar1_Click(object sender, EventArgs e)
        {        }        private void pictureBox1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("It's a picture!");
        
        }        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show(textBox1.Text);
        }
    }
}没有加最后一个private 时运行正常,加了这个之后,不能运行了,提示
错误 1 无法将文件“obj\Debug\progressSample.exe”复制到“bin\Debug\progressSample.exe”。文件“bin\Debug\progressSample.exe”正由另一进程使用,因此该进程无法访问该文件。 progressSample

解决方案 »

  1.   

    请先关掉上一个progressSample.exe程序。
      

  2.   

    任务管理器--进程里看看是否还有progressSample.exe这个程序没有关闭。
      

  3.   

    打开任务管理器 找到progressSample.exe进程,并结束他
      

  4.   

     无法将文件“obj\Debug\progressSample.exe”复制到“bin\Debug\progressSample.exe”。文件“bin\Debug\progressSample.exe”正由另一进程使用,因此该进程无法访问该文件,已经说明了.
      

  5.   

    试问有多少人懂了Lz所谓的最后一个private...
      

  6.   

    打开任务管理器,找到progressSample.exe进程,结束该进程。