private void domainTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { OKbutton.PerformClick(); // these last two lines will stop the beep sound e.SuppressKeyPress = true; e.Handled = true; } }