vba "On Enter" event

Posted on 2009-04-23
Last Modified: 2013-11-27
I am quite familiar with the vba "On Enter" event.
My question is this:
What is its equivalent in VB9 (Visual studio 2008)

I had a text box in vba that responded to an "enter" send from a barcode scanner using the "on Enter" event. I cant seem to reproduce this behaviour.

Any ideas would be gratefully received.
Question by:JoseJalapeno
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    When you say on Enter, are you referring to the Enter key being pressed?
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    Or in better terms, the textbox receives a CRLF?

    Author Comment

    Yes you are correct.
    The "Enter" event in VB9 triggers when the textbox gets the focus not a crlf
    LVL 74

    Accepted Solution

    I do not have a scanner to test with, but have you tried/can you try:
    Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
        If e.KeyCode = Keys.Enter Then
            'do something
        End If
    End Sub

    Open in new window


    Author Closing Comment

    Kaufmed! you are a gentleman, it worked first time.
    This VB9 is very different to VB6 and office2007 vba it will take me a while to get used to it.
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    I think in time you'll grow to like it better. It is frustrating first starting out because you're used to the old ways, but once you get the hang of it, it will be a breeze.

    For me, it was going backwards, from VB9 to VB6...  what a joy that was ;)

    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

    For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    755 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

    17 Experts available now in Live!

    Get 1:1 Help Now