How to suppress Enter button on a multiline TextBox

A TextBox handles key operations in KeyPress event.

So, You can surpress Enter button in KeyPress event by changing the KeyPressEventArgs.Handled property to true when KeyChar property is 13.

this.textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
      if (e.KeyChar == (char)13)
      {
            e.Handled = true;
       }
}

Today, I went to Mori Art Museum at Roppongi in Tokyo. I saw a exhibition of Odani Motohiko. His arts are a little grotesque, but exciting. Also, colored leaves were beautiful in the park near the museum.

IMG_0156.jpg

--

Ebook Download
View all
Learn
View all