16进制验证

        private void txt_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Regex.IsMatch(e.KeyChar.ToString(), "^[0-9]*$") && !Regex.IsMatch(e.KeyChar.ToString(), "^[A-Fa-f]"))
            {
                e.Handled = true;
            }
        }

 

posted on 2012-11-20 16:22  酒歌  阅读(154)  评论(0编辑  收藏  举报