textbox的验证

代码以下:spa

textBox1.KeyDown += (a, b) =>
    {
        if (b.KeyCode == Keys.Enter)
        {
            textBox2.Focus();
        }
    };
textBox1.Leave += delegate
    {
        int result;
        if (!int.TryParse(textBox1.Text.Trim(), out result))
        {
            MessageBox.Show("fsfd");
            textBox1.Focus();
        }
    };
相关文章
相关标签/搜索