📜  wpf 仅数字文本框 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:08.889000             🧑  作者: Mango

代码示例1


-------------------------------------------------------------------------------

using System.Text.RegularExpressions;
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
    Regex regex = new Regex("[^0-9]+");
    e.Handled = regex.IsMatch(e.Text);
}