代码如下:

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();
        }
    };

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2021-06-07
  • 2022-12-23
  • 2021-12-10
  • 2021-07-21
相关资源
相似解决方案