我在layoutcontrol1下的表单上有许多Devexpress控件。我使用下面的代码 来遍历每个控件,并在用户单击“清除”按钮时清除现有数据。但是,它在LookupEdit(将EditValue设置为0)和CheckedListBoxControl(取消选中所有选定项目)上不起作用。如何清除表单数据
foreach (Control c in layoutControl1.Controls)
{
if (c.GetType() == typeof(TextEdit) || c.GetType()==typeof(MemoEdit))
c.Text = String.Empty;
if (c.GetType() == typeof(LookUpEdit))
c.EditValue = 0; //doesn't have EditValue property
if (c.GetType() == typeof(CheckedListBoxControl))
c.CheckedItems = CheckState.Unchecked; //doesn't have such property
}
有什么建议吗?
是指这样一个问题:[?我们怎样才能清除的WinForm的所有表单控件] [1] 或 [什么是最好的方式清除上的形式C#所有控件] [2] 也许是有用的 [1]:http://stackoverflow.com/questions/14620375/how-can-we- clear-the-all-form-controls-on-winform [2]:http://stackoverflow.com/questions/297526/what-is-the-best-way-to-clear-all-controls-on -a-form -c –