472,139 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Handlers in VB .NET

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
Jul 17 '05 #1
6 3277
Almost everybody in this newsgroup is using VB6 or lower. While you may
get a stray answer to VB.NET questions here, you should ask them in
newsgroups devoted exclusively to .NET programming. Look for newsgroups
with either the word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

There are some others, but these should get you started.

Rick - MVP

"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


Jul 17 '05 #2
Thanks Rick!

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:Jd********************@comcast.com...
Almost everybody in this newsgroup is using VB6 or lower. While you may
get a stray answer to VB.NET questions here, you should ask them in
newsgroups devoted exclusively to .NET programming. Look for newsgroups
with either the word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

There are some others, but these should get you started.

Rick - MVP

"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

Jul 17 '05 #3
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
Jul 17 '05 #4
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


Jul 17 '05 #5
Actually I am using VB .NET. How would you do it in .NET?

<Eddie B> wrote in message
news:2q********************************@4ax.com...
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

Jul 17 '05 #6
Hal has it right, do that :)

On Mon, 2 Aug 2004 14:34:28 -0400, "Kim C" <ki***@cox.net> wrote:
Actually I am using VB .NET. How would you do it in .NET?

<Eddie B> wrote in message
news:2q********************************@4ax.com.. .
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 messagenews:1tcOc.117$73.48@lakeread04... >> I have several textboxes and I want one dbl click handler to be usedfor >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 usethe >> 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
>


Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeff Shannon | last post: by
reply views Thread by Vinay Sajip | last post: by
10 posts views Thread by tony kulik | last post: by
13 posts views Thread by Charles Law | last post: by
1 post views Thread by bneron | last post: by
14 posts views Thread by Hamed | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.