VB.Net Tutorial/Development/Clipboard

Материал из VB Эксперт
Перейти к: навигация, поиск

My.Computer.Clipboard: Clear, ContainText, SetDataObject and GetText

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.ruputer.Clipboard.Clear()
      Dim data As DataObject = New DataObject(DataFormats.Text, stringToWrite)
      My.ruputer.Clipboard.SetDataObject(data)
      If My.ruputer.Clipboard.ContainsText() Then
         stringToRead = My.ruputer.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.