Catch enter button

Posted on 2007-07-22
Last Modified: 2013-11-26
Need some help to catch a keypress

If I press Enter button in a numeric box I want to do som stuff..

How do I catch it
Question by:AWestEng
    1 Comment
    LVL 3

    Accepted Solution

    Use the KeyDown event of the control to capture the keys when they are pressed. The KeyDown event occurs before the KeyPress event. Here is an example of code to place in the KeyDown Event of the control:

    Private Sub textBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) _  
       If (e.KeyCode = Keys.Enter) Then
       End If
    End Sub 'textBox1_KeyDown

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    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 …
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    745 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

    18 Experts available now in Live!

    Get 1:1 Help Now