Come trasformare gli ENTER (INVIO) in TAB


Poche righe di codice per trasformare gli Enter dell'utente in Tab e spostare il focus sul controllo successivo:

Impostare la propieta' KeyPreview del Form sul valore TRUE ed
inserire il seguente codice nell'evento KeyPress dello stesso Form:

Sub Form_KeyPress (KeyAscii As Integer)
If KeyAscii = 13 Then
    If TypeOf ActiveControl Is TextBox Then
        SendKeys "{TAB}"
        KeyAscii=0
    End If
End If
End Sub

Testato su: Windows 98, Windows Me, Windows 2000 Professional