Solved

Trapping the Tab key in VB2010

Posted on 2014-07-28
4
187 Views
Last Modified: 2014-07-28
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
Comment
Question by:Jeff_Kingston
  • 2
4 Comments
 
LVL 48

Expert Comment

by:Rgonzo1971
Comment Utility
0
 

Author Comment

by:Jeff_Kingston
Comment Utility
Sorry I don't read German.

If this is the case, how does one check for either Enter or Tab????
0
 
LVL 48

Expert Comment

by:Rgonzo1971
Comment Utility
0
 
LVL 32

Accepted Solution

by:
Stefan Hoffmann earned 500 total points
Comment Utility
Use the PreviewKeyDown event,
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now