473,547 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to select the text in a TextBox

ad
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?
Feb 5 '06 #1
5 2317
You can do it on client side with a javascript call myTextBox.selec t();

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** *****@tk2msftng p13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?

Feb 5 '06 #2
ad
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re************ *@monarchmed.co m> ¼¶¼g©ó¶l¥ó·s»D: Od************* @TK2MSFTNGP15.p hx.gbl...
You can do it on client side with a javascript call myTextBox.selec t();

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** *****@tk2msftng p13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?


Feb 5 '06 #3
ad
I use:

myTextBox.Attri butes["onfocus"] = myTextBox.Clien tID + ".sclect(); ";

But it can't work.

"ad" <fl****@wfes.tc c.edu.tw> ¼¶¼g©ó¶l¥ó·s»D: eb************* *@TK2MSFTNGP09. phx.gbl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re************ *@monarchmed.co m> ¼¶¼g©ó¶l¥ó·s»D: Od************* @TK2MSFTNGP15.p hx.gbl...
You can do it on client side with a javascript call myTextBox.selec t();

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** *****@tk2msftng p13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #4
When do you want the textbox to get focus and become selected? When the page
loads? When a button is clicked?

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** ******@TK2MSFTN GP09.phx.gbl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re************ *@monarchmed.co m>
¼¶¼g©ó¶l¥ó·s»D: Od************* @TK2MSFTNGP15.p hx.gbl...
You can do it on client side with a javascript call myTextBox.selec t();

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** *****@tk2msftng p13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #5
ok, you can take this way. Just try

myTextBox.Attri butes["onfocus"] = "this.select(); ";

Eliyahu
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eh******** ******@TK2MSFTN GP15.phx.gbl...
I use:

myTextBox.Attri butes["onfocus"] = myTextBox.Clien tID +
".sclect(); ";

But it can't work.

"ad" <fl****@wfes.tc c.edu.tw>
¼¶¼g©ó¶l¥ó·s»D: eb************* *@TK2MSFTNGP09. phx.gbl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re************ *@monarchmed.co m>
¼¶¼g©ó¶l¥ó·s»D: Od************* @TK2MSFTNGP15.p hx.gbl...
You can do it on client side with a javascript call myTextBox.selec t();

Eliyahu

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:eb******** *****@tk2msftng p13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(T ext1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #6

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

Similar topics

3
21694
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 to happen if the mouse is used to select the TextBox. Seems wierd, If the Textbox has the default text in it the higlight works but not if you...
1
2062
by: Mad Scientist Jr | last post by:
I'm stuck trying to work with a HTML <SELECT> control and javascript (similar to DualList but that control doesn't offer enough options to totally control the text on the buttons and control, also I don't have c# on this machine to try and modify it).. anyway... I'm trying to get javascipt to select all items in a <SELECT> control and...
2
4329
by: Cindy M -WordMVP- | last post by:
Hi all While working my way through a VB.NET exercise, I came across something that didn't do what the text said it should and I'm wondering if it's supposed to behave this way, or not (and why). txtNote.Text = "the text" txtNote.Enabled = True 'txtNote.Select()
4
5418
by: Brett | last post by:
I have a textbox with a heigth of 384. I put a lot of text into it and must scroll down to see it all. When I do Ctrl + A, it doesn't highlight all of the text. I have to manually drag my mouse to get the text. Is there a way to engage the select all? Thanks, Brett
3
30093
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me set all numericupdown autoselect text when gotfocus?
8
21865
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...
4
8659
by: Dabbler | last post by:
Is there a way to mark the text in a TextBox control as selected so when the user types a new value the existing text is replaced? Thanks
12
2139
by: Brano | last post by:
Hi I am using vb.net 2005 this is a windows application I am using this functionality in another project I have created this simple project to show the problem Basically I have two forms: Form1 - contains a panel (System.Windows.Forms.Panel)
13
5767
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table CatalogImage where imgID also needs to be placed. Below is my code behind to carry the catID using the Select @@Identity and insert imgID to the bridge...
0
7510
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...
0
7797
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...
0
6032
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
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...
0
3493
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1923
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
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.