Public Sub PasteIntoRichTextBox(ByVal rtb As RichTextBox) Dim data As IDataObject = Clipboard.GetDataObject()
If data.GetDataPresent(DataFormats.Rtf, False) Then rtb.SelectedRtf = data.GetData(DataFormats.Rtf).ToString() ElseIf data.GetDataPresent(DataFormats.Text, True) Then rtb.SelectedText = data.GetData(DataFormats.Text, True).ToString() End If End Sub |