private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
if (e.KeyChar == (char)System.Windows.Forms.Keys.Enter)
{
//执行操作
if (this.textBox1.Text.Trim().Length == 0 )
{
MessageBox.Show("请输入");
return;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}