我的文本框名为txtchild。我只想要两位数不需要。当用户输入超过两位数时,它会给出错误消息。
请帮帮忙
发布于 2013-10-01 10:45:49
private void txtchild_KeyPress(object sender, KeyPressEventArgs e)
{
if(txtchild.Text.lenght>2)
{
e.Handled = true;
}
else
{
MessageBox.Show("Value must be Two digit");
}
}
https://stackoverflow.com/questions/19110399
复制相似问题