你可以这样
if(textBox[i].Leave!=null)
textBox[i].Leave+= new System.EventHandler(this.textBox_Leave);

解决方案 »

  1.   

    public bool IsEanble=false;
    用一个bool来判断,在事件中加入:IsEanble=true;然后if (IsEanble)
    //....就可以了
      

  2.   

    不好意思反了!
    if(textBox[i].Leave==null)
    textBox[i].Leave+= new System.EventHandler(this.textBox_Leave);
      

  3.   

    帆的方法不行,你自己试试就知道了yarshray的方法我也想过,如果要加标志的话就不止一个了,因为这个textBox数组的Leave事件都执行textBox_Leave,所以每个textBox都要一个标志
      

  4.   

    yarshray(saga jion) 的方法不错使用bool变量
      

  5.   

    ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpconeventsoverview.htm
    给你个参考
      

  6.   

    帆,如果使用
    if(textBox[i].Leave == null)会出现以下编译错误------------------------------------------------------
    E:\Code\C#\StatClass\ReportPanel.cs(373): 事件“System.Windows.Forms.Control.Leave”只能出现在 += 或 -= 的左边
      

  7.   

    将你的代码改为
    private void Init()
    {
       for(int i = 0; i < textBox.Length; i++)
       {
    textBox[i].Leave-= new System.EventHandler(this.textBox_Leave);
    textBox[i].Leave+= new System.EventHandler(this.textBox_Leave);
       }
    }