0

Hi,

I have a rich text box and i like to skip enter key on the rich text box. i.e; If user pressed enter key the rich text box cursor should not move to next line rather than it should do some action.

I have achived this to some what. When enter key pressed it do action what needs to be done. the issue is, it also putting enter in the RTB. Say pointer in 70 line and i pressed enter key pointer move to 71 line and do the action what i have given. it needs to be pointer in 70 line and do the action. How to achive this....

Thanks in advance.....

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by __avd
1

Handle KeyDown event.

private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                MessageBox.Show("Do some action here...");
                e.Handled = true;
            }

        }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.