using System.Text .RegularExpressions;
private void txtChequeCode_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter )
{
if(Regex.Match (this.txtChequeCode .Text .Trim (),@"^\d+$").Success )
{
this.txtChequeSum .Focus ();
this.txtChequeSum .Select ();
}
else
{
MessageBox.Show ("输入无效!,只允许输入数字");
}
}
}
private void txtChequeSum_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter )
{
if(Regex.Match (this.txtChequeSum .Text .Trim (),@"^\d+$").Success )
{
this.ButtonSave .Focus ();
this.ButtonSave .Select ();
}
else
{
MessageBox.Show ("输入无效!,只允许输入数字");
}
}
}