> Is there any other way??
> I don't want the RichTextBox to be Multiline.
Well, you could catch the enter keypress and ignore it, effectively making
it singleline although you could possibly paste a multiline string.

Signature
Happy Coding!
Morten Wennevik [C# MVP]
Marcin Waligora - 23 Oct 2004 19:50 GMT
That's generally a problem. I can go with multiline, but I must catch enter
and tab, to prevent them from going into RichTextBox message. This is the
code I use to ignore the ENTER and TAB, but it doesn't work. Tab still moves
caret and enter moves it one line. Is there something wrong in this code??
I really appreciate your help.
private void keyDown(object sender, System.Windows.Forms.KeyEventArgs e){
if(e.KeyCode == Keys.Enter ){
e.Handled = true;}
if(e.KeyCode == Keys.Tab){
e.Handled=true;
}
Morten Wennevik - 24 Oct 2004 11:19 GMT
I'm not sure why the enter gives you a new line as on my system it does
not.
However, I couldn't prevent TAB doing its default behaviour of adding \t.
You probably need to handle ProcessCmdKey in an inherited RichTextBox.

Signature
Happy Coding!
Morten Wennevik [C# MVP]