By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,980 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,980 IT Pros & Developers. It's quick & easy.

Textbox Click Event needed.

P: n/a
I am working with a panel of preconfigured textbox controls arranged
in rows and columns. They are programmatically updated based on
changing data from an external data collector device.

I would like to add a textbox_ click event property to one specific
column, of this group, which I intend to use as a trigger to prompt
for additional user supplied information. I don't see a way to do
this in the textbox properties, so is there is some convenient way to
add this property to textbox controls? If so, could you provide a
code snippet example of how to do this?

Thanks,
Ally

Apr 9 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ally wrote in news:hf********************************@4ax.com:

I am working with a panel of preconfigured textbox controls
arranged in rows and columns. They are programmatically updated
based on changing data from an external data collector device.

I would like to add a textbox_ click event property to one
specific
column, of this group, which I intend to use as a trigger to
prompt for additional user supplied information. I don't see a
way to do this in the textbox properties, so is there is some
convenient way to add this property to textbox controls? If so,
could you provide a code snippet example of how to do this?


Got focus?
--
Cheers, ymt.
Apr 9 '06 #2

P: n/a
Hi,
I would like to add a textbox_ click event property to one specific
column,...
Events and Properties are two separate things. It might help to
identify what exactly you want to add.
...which I intend to use as a trigger to prompt
for additional user supplied information


If I understand you correctly, then your problem can simply be solved
by making a common EventHandler for all the TextBoxes in that column,
and wiring the Click / MouseDown event to this EventHandler. For
instance :

Private Sub MySpecialTextColumnHandler(Byval sender as Object, Byval e
as EventArgs) Handles Text1.Click, Text2.Click, Text3.Click....
' First identify the Textbox that was clicked
Dim txt as TextBox = DirectCast(sender, TextBox)
' Take necessary actions...
:
:
End Sub

If you need to take special actions depending on the MouseButton that
was clicked, then wire up the handler to the MouseDown events instead.

HTH,

Regards,

Cerebrus.

Apr 9 '06 #3

P: n/a
On 9 Apr 2006 08:57:23 -0700, "Cerebrus" <zo*****@sify.com> wrote:
Hi,
I would like to add a textbox_ click event property to one specific
column,...
Events and Properties are two separate things. It might help to
identify what exactly you want to add.
...which I intend to use as a trigger to prompt
for additional user supplied information


If I understand you correctly, then your problem can simply be solved
by making a common EventHandler for all the TextBoxes in that column,
and wiring the Click / MouseDown event to this EventHandler. For
instance :

Private Sub MySpecialTextColumnHandler(Byval sender as Object, Byval e
as EventArgs) Handles Text1.Click, Text2.Click, Text3.Click....
' First identify the Textbox that was clicked
Dim txt as TextBox = DirectCast(sender, TextBox)
' Take necessary actions...
:
:
End Sub

If you need to take special actions depending on the MouseButton that
was clicked, then wire up the handler to the MouseDown events instead.

HTH,

Regards,

Cerebrus.

Thanks your for your help! You've provided a way to do what I'm
after, but I don't understand how to identify which textbox triggered
the event.

Using your example, with three textboxes as the underlying controls
for example, how would you go about identifying which one called the
click event?

Ally
Apr 9 '06 #4

P: n/a
<ally> schrieb:
I would like to add a textbox_ click event property to one specific
column, of this group, which I intend to use as a trigger to prompt
for additional user supplied information. I don't see a way to do
this in the textbox properties, so is there is some convenient way to
add this property to textbox controls? If so, could you provide a
code snippet example of how to do this?


You may want to handle the control's 'Enter' or 'GotFocus' event.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Apr 9 '06 #5

P: n/a
Hi,

It depends on what is the distinguishing property of the textboxes. You
could check the Name property or the Tag property (which you have to
set beforehand), for instance. In the sample code I provided above,
before "Take necessary actions", you could run a check in this way :

Select case txt.Tag
Case "Absurd"
' Do something
Case "Wierd"
' Do something
Case "Crazy"
' Do something
End Select

Hope this helps,

Regards,

Cerebrus.

Apr 9 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.