Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Trapping the Tab key in VB2010

Posted on 2014-07-28
4
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 40224222
0
 

Author Comment

by:Jeff_Kingston
ID: 40224231
Sorry I don't read German.

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

Accepted Solution

by:
ste5an earned 2000 total points
ID: 40224274
Use the PreviewKeyDown event,
0

Featured Post

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

722 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