Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Keypress event

Posted on 2005-04-04
Medium Priority
Last Modified: 2010-04-17
How do I made a textbox_Keypress event for all my textboxes at once
Thank you

Question by:Ernesto
  • 2
LVL 23

Expert Comment

ID: 13702526
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.
LVL 23

Accepted Solution

gecko_au2003 earned 375 total points
ID: 13702548
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.

Author Comment

ID: 13702949
Thank you geko
I ´m going to tray

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Loops Section Overview

578 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