Enter Key acting as TAB Key?

zimzon

Member
Joined
Oct 31, 2006
Messages
13
Programming Experience
Beginner
Hi,

I have a form in whie there are more than 25 controls such as textbox, combo, table.

I want to code in each control's Keydown even, it should call a function or routine. The code will control the cursor position (ie. When hittin "Enter" Key, the cursor will move to next textbox/combobox. When hitting "Shift+Enter" keys it will move to previous textbox/combobox)


pls someone help me

Zim.....
 
Create a single event handler and add the KeyDown event of every control you want handled to its Handles clause. Then add the following code:
VB.NET:
If e.KeyCode = Keys.Enter AndAlso _
   Not e.Control AndAlso _
   Not e.Alt Then
    Me.SelectNextControl(DirectCast(sender, Control), _
                         Not e.Shift, _
                         True, _
                         True, _
                         True)
End If
 
Back
Top