Need I remove controls after disposing them?

后端 未结 6 2100
闹比i
闹比i 2020-12-15 20:52

.NET 2

// dynamic textbox adding
myTextBox = new TextBox();
this.Controls.Add(myTextBox);

// ... some code, finally

// dynamic textbox rem         


        
6条回答
  •  醉话见心
    2020-12-15 21:28

    Further Information on Compact Framework 2 + VS2005 Designer may crash when removing a control which is derived from s.w.f.control, if it doesn't implement the following:

    Dispose()  
    {  
     if(this.parent!=null){  
      this.parent.controls.remove(this);   
     }  
     ....  
    }  
    

提交回复
热议问题