473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 3340
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeff Shannon | last post by:
I'm having some difficulty getting my logging configuration set correctly. I'm using a config file (copied at end of post), with the intent of setting several loggers which write to a combination...
0
by: Vinay Sajip | last post by:
Currently, if the logging module is used with no handlers configured for a logger or its parents and you try to log events with that logger, a single message is printed to sys.stderr: No...
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
4
by: sm | last post by:
Hi, I have a couple of questions with regards to handling errors and exceptions. 1. If I use On Error goto Errhandler ... Errhandler:
1
by: bneron | last post by:
hello, I use the logging module include in Python 2.4 distribution, and I 'd like to have a logger witth several Handlers . I know how to do this by coding in python, but could I specify this...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
3
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.