清空Text文本框内容

#region 清空Text文本框内容
        /// <summary>
        /// 清空Text文本框内容
        /// </summary>
        /// <param name="Controls">控件集合</param>
        public static void ClearText(Control.ControlCollection Controls)
        {
            string mytext;
            foreach (Control co in Controls)
            {
                mytext = co.GetType().ToString();
                if (mytext == "System.Windows.Forms.TextBox")
                    ((TextBox)co).Clear();
            }
        }
        #endregion

 //清空Text中数据
private void ClearText()
{
foreach (Control ctrl in this.form1.Controls)
{
if (ctrl is TextBox )
{
(ctrl as TextBox).Text = string.Empty;
}
else if (ctrl is HtmlTextArea)
{
(ctrl as HtmlTextArea).Value = string.Empty;
}
}
}

posted @ 2011-02-28 15:26  xfyn  阅读(4508)  评论(0编辑  收藏  举报