本文整理匯總了VB.NET中System.Windows.Forms.DataFormats.UnicodeText字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataFormats.UnicodeText字段的具體用法?VB.NET DataFormats.UnicodeText怎麽用?VB.NET DataFormats.UnicodeText使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.Windows.Forms.DataFormats
的用法示例。
在下文中一共展示了DataFormats.UnicodeText字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: CType
Try
Dim myString As String = "This is a String from the ClipBoard"
' Sets the data into the Clipboard.
Clipboard.SetDataObject(myString)
Dim myDataObject As IDataObject = Clipboard.GetDataObject()
' Checks whether the format of the data is 'UnicodeText' or not.
If myDataObject.GetDataPresent(DataFormats.UnicodeText) Then
Console.WriteLine($"Data in 'UnicodeText' format:{myDataObject.GetData(DataFormats.UnicodeText)}")
Else
Console.WriteLine("No String information was contained in the clipboard.")
End If
' Checks whether the format of the data is 'Text' or not.
If myDataObject.GetDataPresent(DataFormats.Text) Then
Dim clipString As String = CType(myDataObject.GetData(DataFormats.StringFormat), String)
Console.WriteLine($"Data in 'Text' format:{clipString}")
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
End Class