Keypress event

How do I made a textbox_Keypress event for all my textboxes at once
Thank you

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.

Shane Russell2nd Line Desktop SupportCommented:
Make a control array of text box's ie configre the first textbox how you want it , ie if you want to change background colour of it, or font size, fonts, etc, then copy and paste it. When it asks you do you want to make a control array, click Yes. Copy and paste as many as you want. Then from there when you double click on the textbox it will give you a variable something like Index As Integer and you can use a for next loop to loop through all of the controls in that control array.
Shane Russell2nd Line Desktop SupportCommented:
Private Sub TextBox1_KeyPress(Index As Integer)
For each ctl In Control
If ctl = "TextBox" Then
MsgBox "You pressed a key in a textbox"
End If
End Sub


Private Sub TextBox1_KeyPress(Index As Integer)
For i = 0 To 10 '< Change the 10 to the last Index value of the textbox you have
Msgbox "You pressed a key in the textbox"
End Sub

The coding would be something along those lines :)

I hope this helps, just I do not have visual basic at my disposal to get you the exact code.

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
ErnestoAuthor Commented:
Thank you geko
I ´m going to tray
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

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.