473,396 Members | 1,812 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,396 software developers and data experts.

Can we use the SELTEXT property outside textbox control?

In my form i need to select the value in my textbox as soon as i click a button. But when i gave the txtname.seltext inside the button click event im receiving an error as 'misuse of the property'...
Thanks in advance....
Jan 18 '11 #1
2 4220
ADezii
8,834 Expert 8TB
In order to select Text in a Text Box via the Click() Event of a Command Button:
  1. Make sure the Text Box does not contain a NULL Value, if it does simply Exit the Click() Event in one form or another. (Line 5).
  2. Set Focus to the Text Box. (Line 6).
  3. Set the SelLength of the Text Box equal to the Length of the Value in the Text Box. This will select the Text in its entirety. (Line 7).
  4. To retrieve the Selected Text, use the SelText Property. (Line 8).
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Command120_Click()
    2. 'Substitute your Text Box Name for Text2
    3. Set txt = Me![Text2]
    4.  
    5.   If Not IsNull(txt) Then
    6.     txt.SetFocus
    7.     txt.SelLength = Len(txt.Value)
    8.       MsgBox "The Text Selected is " & txt.SelText
    9.   End If
    10. End Sub
Jan 18 '11 #2
Thanks... It works:)
Jan 19 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sreenish | last post by:
Hi All, How can I change the boder color of a TextBox control? I am trying to crate a new control derived from TextBox with a new property BorderColor. I could not find a way to do this. ...
3
by: MLH | last post by:
I'm having trouble pasting a VLS into a textbox control on FormB. FormB is open in form view. I'm trying to do it from a procedure running in FormA. I'm up against 2048-Char limits no matter how...
1
by: Beza | last post by:
Can you change the "Enabled" property of a Textbox control with CSS? Also, is there a property that allows you to change the appearance of a textbox so that it isn't "sunken" i.e. it's "flat"? If...
3
by: Chumley the Walrus | last post by:
I have a textbox control that represents a username in a password scheme, and I'm trying to turn the ID of the textbox control (the id = lgname ) into a session object. Doing lgname.text =...
2
by: fabrice | last post by:
Hi, I have a trouble with my TextBox Control and it's ViewState in my form... The property for it, is FALSE as following : <form id="frmSearchBre4" runat="Server"> <asp:textbox id="myID"...
1
by: varsha11 | last post by:
how to create textbox control array at design time. in VB6 we use index property of textbox control is there any property in .NET
7
by: panks2007 | last post by:
Hi, The scrollbars property in one activex which works similar to scrollbars property of textbox control when click on the region between slilder and arrow its moving either end. so, how to...
6
by: Shelly | last post by:
In looking at the asp.net TextBox, I noticed that there is a property called "OnTextChanged". I tried to use this control to call a subroutine called "GetCompanyProperties". The field is the...
7
by: Ned White | last post by:
Is it possible to insert HTML codes to a textbox control ? I am reading HTML formated string from sql server but if i assign this value to Text property of TextBox, the format tags of HTML seems...
1
by: mahendra dubey | last post by:
Hi There I am working on my first WPF project.I have a TextBox control.In Binding property of this TextBox,I want to set ValidatesOnDataErrors=true. But if this TextBox is disabled then I...
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: 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
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,...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.