码迷,mamicode.com
首页 > Windows程序 > 详细

遍历winform 窗体控件

时间:2016-01-02 06:58:39      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:

 //遍历窗体控件并给控件赋值
        private void Control_Load(object sender, EventArgs e)
        {
            foreach (Control Ctr in this.Controls)
            {
                if (Ctr is System.Windows.Forms.CheckBox)
                {
                    checkBox1.Checked = true;
                }
                else if (Ctr is TextBox)
                {
                    this.textBox1.Text = "赋值数据";
                }
            }
        }

遍历winform 窗体控件

标签:

原文地址:http://www.cnblogs.com/andyhuo/p/5094078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!