Prevent RichTextBox from creating new line when enter is pressed
<p>I want to run a method when the <kbd>Enter</kbd> key is pressed within a <code>RichTextBox</code> so I made this code.</p>

<pre><code>private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
        MessageBox.Show("Hello World");
}
</code></pre>

<p>But I don't want to make a new line when the <kbd>Enter</kbd> key is pressed. But I can't manage to make that work.</p>