Function to send focus to the next control in vb.net 2013

Hi guys,

I'm building my first project in vb.net 2013,  and I'm looking for a function to send the focus to the next control, I mean any control,   for instance, I'm using this code in all my controls:

If Asc(e.KeyChar) = 13 Then
            txtsomething.Focus()
 End If

But I want to use a function to do that, do you guys has any example of it?

Thank you so much.
elm9999Asked:
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.

Jacques Bourgeois (James Burger)PresidentCommented:
If Asc(e.KeyChar) = 13 Then
                  SelectNextControl(ActiveControl, True, True, True, True)
            End If

Look up the documentation (F1 when the cursor is on the method name) to know the meaning of each of the boolean parameters.

By the way, also give a look at the documentation for the Focus method. While it was the way to go in VB6, in .NET it is recommended to use Select instead.
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
elm9999Author Commented:
Thank you Jacques,

Sorry for answer until now, It is a good tip.
0
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
Visual Basic.NET

From novice to tech pro — start learning today.