天天看点

判断输入的字符是否为数字

 #region 判断输入的字符是否为数字

        public bool IsNum(string txt)

        {

            try

            {

                int N = Convert.ToInt32(txt);

                return true;

            }

            catch

            {

                return false;

            }

        }

        #endregion