views:

74

answers:

3

on click event doesn't respond to right mouse click. The event is for a richTextBox. when I try the same code on the form it works fine.

what could be the problem?

EDIT: I use winforms

A: 

You can check this topic, might be useful for recognizing the right click:

A previous question on the matter

vlood
+2  A: 

The Click and MouseClick events are only generated by a left-click. If you want to detect right-clicks then you have to implement the MouseDown or MouseUp event.

Hans Passant
That's not right cause on the form it works.
*What* works? Post code.
Hans Passant
nvm I took the onmousedown event
Yes. Sounds resolved to me, please close your thread by marking it answered.
Hans Passant
+2  A: 

The above answer is correct... you need to check it on the MouseDown event.

private void TextBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) wasRightButtonClicked = true; }

**I tried to up it but I don't have enough points yet