private void textBox_KeyUp(object sender, KeyEventArgs e) { if(e.KeyCode.ToString()=="Enter") {.........你的代码} }