Solved

Select all text in a multiline textbox

Posted on 2003-11-12
4
689 Views
Last Modified: 2010-05-01
I have a text box with multiple lines of characters
i have a command button

i need the command button
to select all the text in the textbox
and copy it to memory /  (clipboard) /(ctrl + c)

so that i can just paste it into another program
can i do this if a the textbox is replaced with a label?




0
Comment
Question by:jxharding
4 Comments
 

Assisted Solution

by:twili
twili earned 50 total points
ID: 9730858
Put these lines under your cmd-button:

ClipBoard.Clear      ' Clear Clipboard.
Clipboard.SetText Textbox.Text, vbCFText      ' Put text on Clipboard (txt-format).

/O.
0
 

Accepted Solution

by:
deathman5 earned 40 total points
ID: 9731112
To Select All Test1:

Text1.SelStart = 0         'start position is at the beginning
Text1.SelLength = Len(Text1.Text)  'length is all available text

To Copy All Text1 To Clipboard:

Clipboard.Clear
Clipboard.SetText Text1.Text

hope it help :)
0
 
LVL 5

Assisted Solution

by:ennixo
ennixo earned 35 total points
ID: 9731131
and to copy a label's text (caption) to the clipboard :

Clipboard.Clear
Clipboard.SetText LabelName.Caption
0
 

Author Comment

by:jxharding
ID: 9737402
all answers working , thank you, before i split the points,
if i have the following in the textbox


line1
line2
line3
line4

and i only select line2 and line3 via dragging  & holding the mouse over it, is the only way
i can copy this selected text by sending sendkeys ctrl & C?
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now