Moving Focus

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
 
R

Ronchese

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
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top