请问如何使在同一窗体内的两个Editbox内容同步,即修改了第一个,另一个也跟着改变。小弟初学,请各位帮帮忙啊

解决方案 »

  1.   

    private void textBox1_TextChanged(object sender, System.EventArgs e)
    {
      this.textBox2.Text = this.textBox1.Text;
    }
      

  2.   

    private void textBox2_TextChanged(object sender, System.EventArgs e)
    {
      this.textBox1.Text = this.textBox2.Text;
    }
      

  3.   

    别忘了
    private void InitializeComponent()
    {
       this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
       this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);}
      

  4.   

    直接把其中的一个绑定到另一个上。把textbox1绑定到textbox2 上
    在textbox2的数据绑定属性中,选简单绑定,填入下面一行即可
    <%#this.textbox1.text%>
      

  5.   

    textBox1_TextChanged
    事件