winform窗体中查找控件

2020-12-13 03:58

阅读:408

标签:winform   for   io   amp   app   text   

     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窗体中查找控件,搜素材,soscw.com

winform窗体中查找控件

标签:winform   for   io   amp   app   text   

原文地址:http://www.cnblogs.com/xiaogongzhu/p/3826309.html


评论


亲,登录后才可以留言!