Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 txtchild 的文本框。我希望它只需要两位数。当用户输入超过两位数字时,它会给出错误消息。
请帮忙
private void txtchild_KeyPress(object sender, KeyPressEventArgs e) { if(txtchild.Text.lenght>2) { e.Handled = true; } else { MessageBox.Show("Value must be Two digit"); } }