Results 1 to 6 of 6

Thread: [RESOLVED] Get HTML from the clipboard?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    [RESOLVED] Get HTML from the clipboard?

    How would I get the HTML from the clipboard?

    Example: If I copy this thread, I do not want to see the text, I want to see the HTML.
    Last edited by Zeratulsdomain; Aug 17th, 2009 at 08:56 PM.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Get HTML from the clipboard?

    Something like this:

    vb.net Code:
    1. MsgBox(Clipboard.GetText())
    I am still very new to VB.NET, so I have MANY questions

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Re: Get HTML from the clipboard?

    that just displays the text, I want the HTML.

  4. #4
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Get HTML from the clipboard?

    You have to view the pages source and copy that to the clip board
    I am still very new to VB.NET, so I have MANY questions

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Re: Get HTML from the clipboard?

    lol, I am aware of that, but that is not what I need.

    Here is the source from that works with VB6: http://support.microsoft.com/kb/274326

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Re: Get HTML from the clipboard?

    Got it:
    vb.net Code:
    1. MsgBox(Clipboard.GetText(TextDataFormat.Html))

    Just got to write the code that will remove the header and tags.

    edit2: And a pure HTML version. Not sure if this could be coded cleaner with vb.net, but it works:

    vb.net Code:
    1. If (Clipboard.ContainsText(TextDataFormat.Html)) Then
    2.             Dim myString As String = Clipboard.GetText(TextDataFormat.Html)
    3.             Dim StartOffset As Integer = InStr(myString, "<!--StartFragment-->")
    4.             Dim EndOffset As Integer = InStr(myString, "<!--EndFragment-->")
    5.             MsgBox(Mid(myString, StartOffset + 20, EndOffset - StartOffset - 20))
    6. End If
    Last edited by Zeratulsdomain; Aug 17th, 2009 at 09:15 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width