Copy and Paste Text with the Windows Clipboard in VB 2005 and Higher

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
 

This uses the MY interface to Copy Data To the Windows Clipboard and to Paste Data from the Windows Clipboard. Visual Basic 2005, Visual Basic.NET 2008, and Visual Basic 2010 is supported.

Copy Text

        Set(Copy) text to the Windows Clipboard.
        My.Computer.Clipboard.SetText("This is my text", TextDataFormat.Text)

Paste Text

        'Get(Paste) text from the Windows Clipboard.
        MsgBox(My.Computer.Clipboard.GetText(TextDataFormat.Text))

3 thoughts on “Copy and Paste Text with the Windows Clipboard in VB 2005 and Higher

Leave a Reply

Your email address will not be published.