Code to copy content to clipboard

  Private _val As String
    Public Property Val() As String
        Get
            Return _val
        End Get
        Set(ByVal value As String)
            _val = value
        End Set
    End Property

    Protected Sub ClipboardBtn_Click(sender As Object, e As EventArgs)
        Val = sender.CommandArgument
        Dim staThread As Thread = New Thread(New ThreadStart(AddressOf myMethod))
        staThread.SetApartmentState(ApartmentState.STA)
        staThread.Start()
    End Sub

If this is working for Windows Forms Applications, you can use the following in IE to copy text:

holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
Advertisements