RichTextBox and AcceptButton

  • Thread starter Thread starter Jeff Haumesser
  • Start date Start date
J

Jeff Haumesser

I have a form with the AcceptButton property set to a command button. I
also have a RichTextBox on the same form. With the AcceptButton property
set, I cannot enter a carriage return in the RichTextBox. It instead
activates the command button that is specified in the AcceptButton property.

Does anyone else have this problem and if so, how can I have both and
AcceptButton property set and able to enter a Carriage Return in the RTB
control?

Thankyou
 
Wrong newsgroup Jeff, this is VB.NET not C#

Regards - OHM


Jeff said:
I have a form with the AcceptButton property set to a command button.
I also have a RichTextBox on the same form. With the AcceptButton
property set, I cannot enter a carriage return in the RichTextBox.
It instead activates the command button that is specified in the
AcceptButton property.

Does anyone else have this problem and if so, how can I have both and
AcceptButton property set and able to enter a Carriage Return in the
RTB control?

Thankyou

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
* "Jeff Haumesser said:
I have a form with the AcceptButton property set to a command button. I
also have a RichTextBox on the same form. With the AcceptButton property
set, I cannot enter a carriage return in the RichTextBox. It instead
activates the command button that is specified in the AcceptButton property.

Does anyone else have this problem and if so, how can I have both and
AcceptButton property set and able to enter a Carriage Return in the RTB
control?

In the RichTextBox's 'GotFocus' event, remove the accept button by
setting the form's 'AcceptButton' property to 'Nothing', in it's
'LostFocus' event handler you can re-assign the button to the property.
 
Yeah, that's what I ended up doing. I just thought there was a more
graceful way to solve it.

Thankyou all for your response.

p.s. I know nothing about C#
 
The Moon is on conjunction with Venus's orbit and the clouds are across
Mars. I can think of no other reason for me to have said that so please
ignore me completely.

OHM


Armin said:

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
The Moon is on conjunction with Venus's orbit and the clouds are across
Mars. I can think of no other reason for me to have said that so please
ignore me completely.

OHM

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
Back
Top