public Form1()
{
InitializeComponent();
txb1.Leave += new EventHandler(txb_Leave);
txb2.Leave += new EventHandler(txb_Leave);
}private void txb_Leave(object sender, EventArgs e)
{
int i = 0;
TextBox tb = (TextBox)sender;
if (!int.TryParse(tb.Text, out i))
{
MessageBox.Show("你输入的不是正确的数字");
//txtNum1.SelectAll();
tb.Text = cur;
tb.Focus();
}
}