Select all text in a text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LAS
    New Member
    • Jul 2007
    • 2

    #1

    Select all text in a text box

    Hello everyone, I am new to this forum and VB.

    I want to copy all the text in a text box when the user clicks a button ("Copy")
    Is there a simple way to do this, I'm sure there is.


    Thankyou,
    Lliam
  • pureenhanoi
    New Member
    • Mar 2007
    • 175

    #2
    Originally posted by LAS
    Hello everyone, I am new to this forum and VB.

    I want to copy all the text in a text box when the user clicks a button ("Copy")
    Is there a simple way to do this, I'm sure there is.


    Thankyou,
    Lliam
    Code:
    Private Sub cmdCopy_Click()
      ClipBoard.SetText text1.Text
    End Sub
    Private Sub cmdPaste_Click()
      Text2.Text =  ClipBoard.GetText
    End Sub

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by LAS
      I want to copy all the text in a text box when the user clicks a button ("Copy")
      Is there a simple way to do this, I'm sure there is.
      Do you mean copy it to the clipboard? The details of how to do this probably vary depending on your VB version. In VB6, I would use something like this...[CODE=vb]Clipboard.SetTe xt Text1.Text[/CODE]

      Comment

      Working...