我是新手,刚开始学C#我创建一了新的Windows应该程序为什么程序运行完之后,我再一次运行提示我:错误 1 无法将文件“obj\Debug\First.exe”复制到“bin\Debug\First.exe”。文件“bin\Debug\First.exe”正由另一进程使用,因此该进程无法访问该文件。 First
我必需在任务管理器把First.exe结束掉才能正常运行

解决方案 »

  1.   

    是一个很简单的东西,单击Form1上的Button显示另一个表单Form1.csusing System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace First
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
              
            }        private void sampleButton_Click(object sender, EventArgs e)
            {
                
                Form2 newForm = new Form2();
                newForm.Show();
                this.Hide();
            }       
        }
    }
    Form2.csusing System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace First
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }        private void label1_Click(object sender, EventArgs e)
            {        }        private void button1_Click(object sender, EventArgs e)
            {
                Form1 newForm = new Form1();
                newForm.Show();
                this.Hide();
            }
        }
    }
      

  2.   

    发错了,Form1.csusing System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace First
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
              
            }        private void sampleButton_Click(object sender, EventArgs e)
            {
                Form2 newForm = new Form2();
                newForm.Show();
                this.Hide();
            }        private void 文件ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                
            }        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form2 newForm = new Form2();
                newForm.Show();
                this.Hide();
            }
        }
    }