[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Trapping the Tab key in VB2010

Here is the code that successfully traps the Enter key but not the Tab key???  What am I missing?

   Private Sub txtBegindate_keypress(sender As System.Object, e As System.EventArgs) Handles txtBeginDate.KeyPress
        Dim tmp As System.Windows.Forms.KeyPressEventArgs = e
        Dim myDateF As Date


        If tmp.KeyChar = ChrW(Keys.Enter) Or tmp.KeyChar = ChrW(Keys.Tab) Then
            myDateF = Format(DateAdd(DateInterval.Day, 49, DateValue(txtBeginDate.Text)), "short date")
            txtThroughDate.Text = myDateF
            txtFeatureStart.Focus()

            'txtSourceNumber.Focus()
        Else
        End If

    End Sub
0
Jeff_Kingston
Asked:
Jeff_Kingston
  • 2
1 Solution
 
Rgonzo1971Commented:
0
 
Jeff_KingstonAuthor Commented:
Sorry I don't read German.

If this is the case, how does one check for either Enter or Tab????
0
 
ste5anSenior DeveloperCommented:
Use the PreviewKeyDown event,
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now