title: Keep formatting of copied text from another application using vb.net
body: <p>I have a little program I have written that sits in the system tray and when clicked will print the selected text(Highlighted by user) of a specific application.This bit works ok and I can get it to print out but it loses the formatting.</p>
  
  <p>I have searched this sight and a lot of others trying to find out how to set the formatting properties of the copied data but am coming up empty.</p>
  
  <p>Here is the code I am using at the moment:-</p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles    Button1.Click
  
      Dim hWnd As IntPtr = FindWindow("putty", Nothing)
  
      EnableWindow(hWnd, True)
  
      Clipboard.Clear()
  
      SendKeys.Send("^c")
      If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) Then
  
          RichTextBox1.Text = Clipboard.GetDataObject().GetData(DataFormats.Text) '.ToString()
      Else
          RichTextBox1.Text = "The clipboad does not contain any text"
      End If
  
      RichTextBox1.Paste()
  
  
      Dim result As DialogResult = PrintDialog1.ShowDialog()
  
      ' If the result is OK then print the document. 
      If (result = DialogResult.OK) Then
  
  
          docToPrint.Print()
      End If
  
  
  
  End Sub
  </code></pre>
  
  <p>Basically I just want it to take a sort of snapshot of the selected text and print it out.</p>
  
  <p>We used to use Clip.exe from NetadminTools.com but I am unable to get it to work on Windows 8.</p>