private void textBox1_KeyPress(object sender, KeyPressEventArgs e)

{

          string pattern = @"^[0-9]|\.$";

          Regex reg = new Regex(pattern);

          if (!reg.Match(e.KeyChar.ToString()).Success)

           {

             e.Handled = true;

           }

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2021-09-23
相关资源
相似解决方案