well the last thing i need is a button that will copy TextBox1.Text like Select All and Copy it all, i use a simple code no very effective... i put sendkeys ctrl & a and ctrl & c but i just realize that all pcs doesn't have the same hotkeys because in my pc laptop ( Spanish ) Ctrl A - Ctrl C is other thing .....

so any help ?
A button to Select & Copy

Recommended Answers

All 3 Replies

Hey, try this code i found on FreeVBcode.com, just call the function in the button code's body.

Public Function GetClipboardText() As String
      Dim objClipboard As IDataObject = Clipboard.GetDataObject()
        With objClipboard
            If .GetDataPresent(DataFormats.Text) Then Return _
               .GetData(DataFormats.Text)
        End With
    End Function

ref: http://www.freevbcode.com/ShowCode.asp?ID=5470

commented: for trying :) +1

well didnt work but i used a simple one

TextBox1.SelectAll()
TextBox1.Copy()

in the button xD

ty anyways Reputation for trying to help :)

well didnt work but i used a simple one

TextBox1.SelectAll()
TextBox1.Copy()

in the button xD

ty anyways Reputation for trying to help :)

Wow.... so simple XD but oh well that's VB :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.