vba "On Enter" event

Posted on 2009-04-23
Medium Priority
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
  • 4
  • 2
LVL 75

Expert Comment

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

Expert Comment

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

Author Comment

ID: 24214998
Yes you are correct.
The "Enter" event in VB9 triggers when the textbox gets the focus not a crlf
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 24215055
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

ID: 31573753
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 75

Expert Comment

by:käµfm³d 👽
ID: 24215141
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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

864 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