标签:change void start 输入 div sha max csharp box
private void txtMaxCount_TextChanged(object sender, EventArgs e)
{
//替换非数字
this.txtMaxCount.Text = Regex.Replace(this.txtMaxCount.Text, @"[^\d]*", "");
// 将光标定位到文本框的最后
this.txtMaxCount.SelectionStart = this.txtMaxCount.Text.Length;
}
C# WinForm TextBox 只能输入数字【正则替换】
标签:change void start 输入 div sha max csharp box
原文地址:https://www.cnblogs.com/wxbug/p/14852048.html