This happened because you used the KeyUp event. And also pressed the Enter key to dismiss the message box. Which does it correctly, it uses the KeyDown event. So the dialog closes, your TextBox gets the focus back and you release the Enter key. To trigger the KeyUp event again :)
Also turn on your speakers to hear the nasty DING! you get from the text box not liking the Enter key.
Use the KeyDown event instead:
private void textBox2_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Enter) {
button1.PerformClick();
e.Handled = e.SuppressKeyPress = true;
}
}