日期:2014-05-17  浏览次数:20876 次

想遍历窗口所有控件,切出现这个,求大侠
 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或者程序集引用,请问各路大侠该如何去解决

------解决方案--------------------
引用:
Quote: 引用:

右键那个异常看看能不能解析出什么类库,加进去

不懂?怎么操作


你这个是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;