Moving Focus

  • Thread starter Thread starter Robert Boudra
  • Start date Start date
R

Robert Boudra

I am capturing the KeyPress event on a series of text boxes and checking for
the presence of the CR character to move the focus to the next textbox in
tab order. I'm able to do this using the focus method of the textbox, but
even though the focus changes when the CR character is pressed, I still get
a "beep" from the textbox where the focus was when enter was pressed. Is
there any way to turn that off?

Bob
 
Try modify the Handled property of the event arguments. For sample:

Private Sub MyControl_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
'(...) your code
e.Handled = True 'this do the key don't process after leave the
procedure
'(...) your code
End Sub


--
[]s
Cesar
Carsoft Consultoria e Sistemas
www.carsoftnet.com.br




"Robert Boudra" <[email protected]> escreveu na mensagem
I am capturing the KeyPress event on a series of text boxes and checking for
the presence of the CR character to move the focus to the next textbox in
tab order. I'm able to do this using the focus method of the textbox, but
even though the focus changes when the CR character is pressed, I still get
a "beep" from the textbox where the focus was when enter was pressed. Is
there any way to turn that off?

Bob
 
Bob,

Try to use the keyup event for getting the key values in future and use the
keypress only to handle that beep as Cesar showed you.

I hope this helps,

Cor
 
Back
Top