想遍历窗口所有控件,切出现这个,求大侠 public void GetAllControls(Control control)
{
for (int i = 0; i < this.Controls.Count; i++)
{
foreach (System.Web.UI.Control control in this.Controls[i].Controls)
{
if (control is TextBox)
(control as TextBox).Text = "";
}
}
}
在this.Controls出现缺少using或者程序集引用,请问各路大侠该如何去解决
分享到:
------解决方案--------------------
你这个是wpf应用程序吧?wpf没有controls属性。
refer:
public void GetAllControls()
{
UIElementCollection Childrens = this.Grid1.Children;
foreach (UIElement element in Childrens)
{
if (element is Button)
{
Button temp = element as Button;