Csharp windowform controls clear

1175 단어 cnulltextbox
/// <summary>
        ///          
        ///     2011-10-18
        ///              
        /// </summary>
        /// <param name="con"></param>
        public void ClearControl(Control.ControlCollection con)
        {
            foreach (Control C in con)
            {
                if (C.GetType().Name == "TextBox")
                    if (((TextBox)C).Visible == true)
                        ((TextBox)C).Clear();
                if (C.GetType().Name == "MaskedTextBox")
                    if (((MaskedTextBox)C).Visible == true)
                        ((MaskedTextBox)C).Clear();
                if (C.GetType().Name == "ComboBox")
                    if (((ComboBox)C).Visible == true)
                        ((ComboBox)C).Text = "";
                if (C.GetType().Name == "PictureBox")
                    if (((PictureBox)C).Visible == true)
                        ((PictureBox)C).Image = null;
            }
        }

            //    
            Control.ControlCollection coll = this.Controls;
            formOperatin.ClearControl(coll);

좋은 웹페이지 즐겨찾기