Click here to Skip to main content
16,018,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to manage enter key focus instead of tab key in vb.net?
Posted

hi,

you need to use keypress/keydown events.

under the keypress event,

VB
If (e.KeyChar = Microsoft.VisualBasic.Chr(13)) Then
    TextBox1.Focus()
End If



refer the following link for understand the key char values

http://www.gtwiki.org/mwiki/index.php?title=VB_Chr_Values[^]

regards,
Prakash.T
 
Share this answer
 
it is working but i want to general code for enter focusing on from keydown event.

any idea for this metter.
 
Share this answer
 
Comments
Prakash Thirumoorthy 7-Mar-13 2:01am    
u can create a common function.. that is it..
Ashish Prajapati 7-Mar-13 3:17am    
thanks

i will try
Ashish Prajapati 7-Mar-13 4:06am    
below code its working

'''if you use form keydown event below code is working
If e.KeyCode = Keys.Enter Then
SendKeys.Send("{TAB}")
End If

'''if you use form keypress event

If Asc(e.KeyChar) = 13 Then
SendKeys.Send("{TAB}")
End If


On Form KeyPress Event

If Asc(e.KeyChar) = 13 Then
SendKeys.Send("{TAB}")
End If


On Form KeyDown Event

SQL
If e.KeyCode = Keys.Enter Then
           SendKeys.Send("{TAB}")
       End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900