473,498 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox.SelectAll() not working

PR
Hello,

I have a bunch of textboxes on my form, and I would very much like it if
their text could be automatically selected when each one is entered.

I've tried code like this:

Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox3.Enter
TextBox3.SelectAll()
End Sub

This works if the entry is due to the tab key being pressed, but it doesn't
work if the box is entered using the mouse. Does anyone have any ideas why
this might be?

Thanks for the help.

Mar 29 '07 #1
2 3048
I have a bunch of textboxes on my form, and I would very much like it if
their text could be automatically selected when each one is entered.
I would also like to know if I can get something like this to happen for
every text box on the form without having to either create a custom object
(overkill) or write the same code in 15 different events (awful). Something
that would apply to the Enter event of every instance of
Sytem.Windows.Forms.Textbox on form Document.

Mar 29 '07 #2
http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60
"Peter" <st*****@hotmail.comschreef in bericht
news:sy*******************@newsread1.news.pas.eart hlink.net...
>I have a bunch of textboxes on my form, and I would very much like it if
their text could be automatically selected when each one is entered.

I would also like to know if I can get something like this to happen for
every text box on the form without having to either create a custom object
(overkill) or write the same code in 15 different events (awful).
Something that would apply to the Enter event of every instance of
Sytem.Windows.Forms.Textbox on form Document.

Mar 29 '07 #3

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

Similar topics

2
15588
by: bullshark | last post by:
VSN03:C# Create a C# Windows Form project. Add two TextBox controls. From the Properties of each, add an Enter Event handler. In the generated Enter Event Handlers (textBox1_Enter &...
3
21688
by: Phill | last post by:
I thought when you tabbed into a textbox that the text it contained was automatically highlighted. This use to be the default in win32. Is there an easy way to do this in .NET. I don't want this...
5
7109
by: Mike L | last post by:
This is my first attempt at inheriting a class. I want to inherit textbox class to my derived class ClassNum. ClassNum will override the TextChanged, Leave, KeyPress and Enter methods. So,...
4
1494
by: Mario | last post by:
Hi there, I'm trying to do an easy thing... but no luck so far... I have a form with a textbox, and I want the following behaviour on mouse click event: -if no text is selected, select all...
10
9000
by: Jane Sharpe | last post by:
Hi, I have a textbox with the words "Enter your name here" inserted as default text - At the moment, to remove this the user must highlight all the text and delete before they type in their name...
12
1667
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...
8
21853
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...
1
3808
by: subbarao.puvvada | last post by:
Hi All, I am working on a Windows application, Which browser control on main form itself develped in .NET 1.1. Recently we have migrated it to .NET 2.0. It's combination of Web pages and .NET...
2
3005
by: lmefford | last post by:
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...
0
7004
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...
0
7167
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
7208
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...
0
7379
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...
1
4915
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...
0
4593
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...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1423
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 ...
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.