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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

770 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