Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

My Computer Clipboard

Option Strict On Imports System.Windows.Forms Public Module Clipbrd    Public Sub Main()       Dim stringToWrite As String = "This data belongs on the Clipboard."       Dim stringToRead As String       My.Computer.Clipboard.Clear()       Dim data As DataObject = New DataObject(DataFormats.Text, stringToWrite)       My.Computer.Clipboard.SetDataObject(data)       If My.Computer.Clipboard.ContainsText() Then          stringToRead = My.Computer.Clipboard.GetText()          Console.WriteLine("The text on the Clipboard: {0}", stringToRead)       Else          Console.WriteLine("There is no text on the Clipboard.")       End If    End Sub End Module The text on the Clipboard: This data belongs on the Clipboard.