Solved

Select all text in a multiline textbox

Posted on 2003-11-12
4
707 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

705 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