The is easier in VB.Net, but I assume you are using VB6 or earlier
You could write an event handler, and assign it all text boxes. This
woould be very easy, if you are using an array of text boxes (ie
txtBox(1), txtBox(2), txtBox(3)) if not, the only way I know how is
like this..
Start a VB project and add 4 text boxes to the form (textbox1,
textbox2...)
Replace any code in the forms code window with this...
Private WithEvents ctlTextBox As TextBox
Private Sub ctlTextBox_Click()
MsgBox ("A box was clicked")
End Sub
Private Sub Text1_Click()
Call ctlTextBox_Click
End Sub
Private Sub Text2_Click()
Call ctlTextBox_Click
End Sub
Private Sub Text3_Click()
Call ctlTextBox_Click
End Sub
Private Sub Text4_Click()
Call ctlTextBox_Click
End Sub
Everytime you click on a text box, the ctlTextBox_Click event will
fire.
Hope this helps :)
On Sat, 31 Jul 2004 03:39:10 -0400, "Hal Rosser"
<hm******@bellsouth.net> wrote:
write the code for one - then -
at the sub declaration where it says "handles textBox1.DblClick" - add a
comma, and then "TextBox2.DblClick, TextBox3.DblClick, ... etc
the "handles" clause tells VB which events it handles
"Kim C" <ki***@cox.net> wrote in message news:1tcOc.117$73.48@lakeread04... I have several textboxes and I want one dbl click handler to be used for
all of the textboxes. How do I set that handler for all of the text boxes? I
know
how to set it for one, but how do I get all of the text boxes to use the
same
handler?
Kim
I
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004