winform窗体中查找控件

     private RichTextBox FindControl()
        {

            RichTextBox ret = null;
            try
            {
                Control[] controls = Application.OpenForms["MainForm"].Controls.Find("txtContent", false);
                if (controls != null && controls.Length > 0)
                {
                    foreach (Control cn in controls)
                    {
                        if (cn is RichTextBox)
                        {
                            ret = (cn as RichTextBox);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return ret;
        }

winform窗体中查找控件,布布扣,bubuko.com

winform窗体中查找控件

上一篇:windows下node.js+sublime中安装coffeescript


下一篇:PopupWindow添加动画效果