例如  TextBox1.TextChanged += delegate(object sender2, EventArgs e2)
                    {                       
                            TextBox TextBoxOther = new TextBox();
                            TextBoxOther = ((TextBox)sender2);
                             
                            //取消 TextBoxOther的TextChanged 
                            TextBoxOther.Undo();                           
                        }
                    };
                }最好代码能跑过

解决方案 »

  1.   


    背后实际上是一大堆的TEXTBOX   一次写10来个TEXTCHANGE事件  很头大的
      

  2.   

    TextBox TextBoxOther = new TextBox();
    TextBoxOther = ((TextBox)sender2);
    两行合起来就好,没必要new一个多余的出来你把事件处理写一个方法,循环注册事件不就好了?for(int i=0; ....)
    {
       txt = new TextBox();
       txt.ID = i;
       txt.TextChanged += 事件处理方法;
       panel1.Controls.Add(txt);
    }
      

  3.   

    要取消的某个的时候就
    if(txt.ID == "5")
       txt.TextChanged -= 事件处理方法;
      

  4.   

    http://topic.csdn.net/u/20110615/16/1d4b1b8c-33bf-437f-bbfb-a1bab431327d.html
    可以参考这个清空事件全部的订阅。但是最好不要用匿名委托,因为如果有不止一个委托,区分它们是困难的。
      

  5.   


    原本是 写成一行的 但是会出错的
    出错 : 未处理的“System.StackOverflowException”类型的异常出现在 C1102.dll 中。