Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleConvert Enter and Escape keys to Tab and Shift-Tab for easy navigation in Visual Basic .NET
DescriptionThis example shows how to convert Enter and Escape keys to Tab and Shift-Tab for easy navigation in Visual Basic .NET.
KeywordsTab, Enter, Escape, Tab key, Enter key, Escape key, dialog
CategoriesMiscellany, Software Engineering
 
Thanks to Luis XV.

Override the form's ProcessDialogKey function. When you see an Enter or Escape key, process a Tab or Shift-Tab key instead. This lets the user navigate through fields by pressing Enter and Escape in addition to Tab and Shift-Tab.

 
' Convert Enter and Escape keys
' into Tab and Shift-Tab.
' Thanks to Luis XV (luisxvarg@hotmail.com).
Protected Overloads Overrides Function _
    ProcessDialogKey(ByVal keyData As Keys) As Boolean
    Select Case keyData
        Case Keys.Enter
            Return MyBase.ProcessDialogKey(Keys.Tab)
        Case Keys.Escape
            Return MyBase.ProcessDialogKey(Keys.Shift Or _
                Keys.Tab)
    End Select
    Return MyBase.ProcessDialogKey(keyData)
End Function
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated