473,626 Members | 3,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textbox MouseDown

Is there a way to modify all textboxes on a form so that when you
click on any of them you process the SelectAll() function.

For exaple, let's say I've created a form with 30 textboxes. These
textboxes when clicked on, will select all of the text inside of them
using the textbox.selecta ll(). I'm hoping to do this without creating
30 different Subs. How do I do it?

Aug 29 '07 #1
2 3014
On Aug 29, 5:19 pm, "lmeff...@gmail .com" <lmeff...@gmail .comwrote:
Is there a way to modify all textboxes on a form so that when you
click on any of them you process the SelectAll() function.

For exaple, let's say I've created a form with 30 textboxes. These
textboxes when clicked on, will select all of the text inside of them
using the textbox.selecta ll(). I'm hoping to do this without creating
30 different Subs. How do I do it?
Ok, I found a way, but it's still pretty lengthy.
I merely used a single mousedown event for one textbox and added a few
textboxes to the handles and then proceeded to use the sender.

Private Sub uione_MouseDown _
(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) _
Handles uione.MouseDown , _
uitwo.MouseDown , _
uithree.MouseDo wn, _
uifour.MouseDow n
sender.SelectAl l()
End Sub

I kind of want to avoid that cause it seems a little slow and I'm
wanting to streamline the code. But if that's the way to do it, then
so be it.

Aug 29 '07 #2
why not just have each of the textboxs' Click events go to the same function,
ex, if the textboxes are in an array

For Each txt As TextBox In arrInput

AddHandler txt.Click, AddressOf ClickEventHere

Next

then in the click event, cast Sender to a textbox and select all...

Private Sub ClickEventHere( ByVal sender As Object, ByVal e...)

Dim txt As TextBox = DirectCast(send er, TextBox)

txt.SelectAll()

End Sub

hope this helps

--
-iwdu15
Aug 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
16303
by: JJ | last post by:
Hi All, I need to create a MouseDown event for a picture box . Am I doing the following right? pictureBox.MouseDown += new System.WinForms.MouseEventHandler(pictureBox_MouseDown) Then
2
3560
by: Rob | last post by:
How can I fix the following warning warning BC40004: sub 'MouseDown' conflicts with event 'MouseDown' in the base class 'Control' and so should be declared 'Shadows'. This warning appears because I entered the following Sub Private Sub MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _ Handles AxWebBrowser1.MouseDown
12
1676
by: Gene Hubert | last post by:
How do I make a TextBox behave like the address bar in IE? That is... If focus is not on the tb, select all text if clicking on the tb or tabbing into the tb. Clicking again deselects the text and sets the insertion point to where clicked. I've tried several options inheriting from TextBox but none work quite right. Thanks Much,
7
3071
by: Itar | last post by:
I'm having a problem supressing characters in a text box. I only want alpha numeric characters (no special chars). I can handle the TextBox_KeyPress event to supress the invalid characters when the user types them in, however that doesn't handle the user pasting invalid characters. I thought to use the MouseDown event but I couldn't figure out how to tell if the user is trying to paste or is copying the text. To paste the text the user...
3
2213
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. But while trying to insert a text box to see when a method is used, and putting a counter to bump some variable? The textbox sits there unchanged. I put a breakpoint at the text write
8
21871
by: cj | last post by:
I asked this question a couple of days ago but am just now looking at it again. I used to use the textbox gotfoucs event to have all the text in the textbox selected when it gotfocus. That doesn't seem to work in .net when the textbox receives focus via a mouse click. Jeffrey and Shane both advised how to get a mouse click to select all the text (thank you both) but using the mousedown or mouseup events doesn't work the way I want it...
5
2839
by: ally | last post by:
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...
3
4929
by: sunny076 | last post by:
Hi, I am wondering if any of you Javascript experts can enlighten me on which event to call. The use situation is that the tetxbox field is populated from the DB and the add/update and delete will work only when a textbox for reason for change is entered. This mean if a user simply type in the same value as before, the ASP.NET textbox will be marked with changed. But it should not limit that a user can not change the whole value in the...
3
5403
by: Patrick [MSFT] | last post by:
Let me preface this with the goal I'm trying to achieve is mimic a feature of another language (Dexterity used by Microsoft Dynamics) and so while a filling a drop down list is a workable solution I'd rather do it like Microsoft Dynamics does and use separate textbox and lookup button. What I have is, simply, is a C# winform, a textbox and a pushbutton. On the textbox, on the validating event of the textbox I check my customer table...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.