以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  删除窗口控件  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=149087)

--  作者:良才
--  发布时间:2020/4/23 8:56:00
--  删除窗口控件

删除窗口第二分区所有控件,请老师指教代码错在哪?谢谢!

Dim tb As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
For Each c As WinForm.Control In e.Form.Controls

  tb.Panel1.RemoveControl(c)
Next

[此贴子已经被作者于2020/4/23 9:36:45编辑过]

--  作者:有点蓝
--  发布时间:2020/4/23 10:09:00
--  
For Each c As WinForm.Control In tb.Panel1.Children


--  作者:良才
--  发布时间:2020/4/23 10:36:00
--  

老师,出现提示,未知错误

Dim tb As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
For Each c As WinForm.Control In tb.Panel1.Children
    tb.Panel1.RemoveControl(c)
Next


--  作者:良才
--  发布时间:2020/4/23 10:40:00
--  

这样可以了

Dim tb As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
For Each c As WinForm.Control In e.Form.Controls
    tb.Panel1.RemoveControl(c.Name)
Next