Working with the Clipboard

The My.Computer.Clipboard property provides members for working with the system clipboard. Table 19.1 summarizes the members.

Image

TABLE 19.1 My.Computer.Clipboard Members

The following code shows how you can clear the clipboard and then copy some text; in the end the code checks if some text is available and, if so, returns the text:

My.Computer.Clipboard.Clear()My.Computer.Clipboard.SetText("This is some text")If My.Computer.Clipboard.ContainsText Then    Console.WriteLine(My.Computer.Clipboard.GetText)End If

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.