【发布时间】:2013-04-13 08:09:24
【问题描述】:
我有一个 GroupBox,我可以在其中动态添加控件。我添加的控件有DevExpress.XtraEditors.TextEdit 和Windows.Forms.Label 两种类型
我正在尝试使用以下方法删除这些控件
foreach (Control control in salesBox.Controls)
{
control.Dispose();
salesBox.Controls.Remove(control);
}
这正确地删除了TextEdit 控件,而不是Label 控件。循环没有遍历Label 控件。
【问题讨论】: