VB 2005: How to Make Pressing "Enter" key to execute all commands under btnEnter_click?

Dear Experts:

Hi!

Here is what I would like to do:

1. In the btnEnter_click sub procedure, I have several commands.
   When "Enter" button is pressed, all the commands are executed properly.
2. Obviously it is much easier to press "Enter" key than to locate the "Enter" button on a small form and to click it.

3.  I have a code which I would like to use to use "Enter" key in the keyboard.

Private Sub txtUSDollar_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCelcius.KeyUp
        If e.KeyCode = Keys.Enter Then
           
      '  Body'



        End If
    End Sub


My question is: Should I copy all the codes in the btnEnter_click and paste it in the area marked
'Body' above?

May I consider btnEnter_click a sub procedure and make it as the follows:

Private Sub txtUSDollar_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCelcius.KeyUp
        If e.KeyCode = Keys.Enter Then
           
       btnEnter_Click ()



        End If

I tried the second and it did not work.

I am a novice but working hard to learn.

Thanks!
   
dutaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BinuthCommented:
set your form's "AcceptButton" property to "btnEnter"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.