设置文本框只能输入特定的符号
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar >= 48 && e.KeyChar <= 57 || e.KeyChar == 8)
{
}
else
{
e.Handled = true;
}
}
private void db_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
Regex re = new Regex("[^0-9.]+");
e.Handled = re.IsMatch(e.Text);
}
GIS需要我们添砖加瓦

浙公网安备 33010602011771号