[RESOLVED] WebBrowser.DocumentText
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: [RESOLVED] WebBrowser.DocumentText

  1. #1
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    [RESOLVED] WebBrowser.DocumentText

    Is there a limit of characters for DocumentText of the WebBrowser control? When I try to copy it to the clipboard, it is always truncated. Any way around this problem?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  2. #2
    Join Date
    Jun 2004
    Location
    NH
    Posts
    674

    Re: WebBrowser.DocumentText

    I've been trying to learn more about the WebBrowser control lately.
    Not an expert at all, but I found a couple links that seem to apply.
    I did read that there is a limit based upon memory, and clipboard.

    It could be a script preventing it. Same one blocking popups maybe.
    sotoasty, posted a similar question here:
    http://www.codeguru.com/forum/showthread.php?t=423580

    Maybe design mode:
    http://social.msdn.microsoft.com/For...-6c3bdc5df0cc/

    http://social.msdn.microsoft.com/For...-ac6ff1281506/


    You could check by shortening what is to be copied, just as a test.
    Then you'll know if it's a memory/clipboard limitation or not.
    Dial it in to the right size, and you'll know exactly what the limit is, if any.
    Last edited by TT(n); March 25th, 2009 at 06:40 PM. Reason: link

  3. #3
    Join Date
    Apr 2008
    Posts
    82

    Re: WebBrowser.DocumentText

    is this what you are doing

    Clipboard.SetDataObject(WebBrowser1.DocumentText, True)

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,961

    Re: WebBrowser.DocumentText

    What version of IE is installed? There are differences in controls as well.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    Quote Originally Posted by TT(n) View Post
    It could be a script preventing it. Same one blocking popups maybe.
    Well, there is no script blocking popups. If you are referring to my other thread...you can see that the issue was that popups where opened in a separate IE instance. This would cause the session data to not be seen. Therefore the server-side would not initiate the data I wanted to see.
    Just so you know...This text-replace implementation is to replace the popup code and make them open in the same window.

    Quote Originally Posted by TT(n) View Post
    Then you'll know if it's a memory/clipboard limitation or not.
    It's for sure not the clipboard because even just outputting it from my project, no clipboard involved, it gives the truncated version.

    I don't see why memory would be the cause here, because there is more than sufficient for this ~40k document.

    Quote Originally Posted by Oblio
    is this what you are doing

    Clipboard.SetDataObject(WebBrowser1.DocumentText, True)
    No. I was just using Clipboard.SetText(web.DocumentText). Doesn't matter. Either way it's truncated before the clipboard is even invoked.

    Quote Originally Posted by dglienna
    What version of IE is installed? There are differences in controls as well.
    Internet Explorer 7. There is no reason why IE7 should be having a problem here.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  6. #6
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,961

    Re: WebBrowser.DocumentText

    I went thru another situation involving IE7. My VB6 program worked on three machines, until client bought Vista laptop. All of a sudden, the vb app was timing out after about two minutes, instead of taking 5 minutes.

    It wasn't until we installed IE7 that both the compiled app, and in the IDE now failed.

    Finally made the connection, and looked it up. The default timeout was changed from ie5 to ie6 and then ie7. Registry hack fixed things.

    Found this, though:

    http://msdn.microsoft.com/en-us/libr...73(VS.85).aspx
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    Sorry David, but none of that has anything to do with my problem. I'm using VB.NET IE7, and the problem is before I even invoke the clipboard.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  8. #8
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,961

    Re: WebBrowser.DocumentText

    No. I was just using Clipboard.SetText(web.DocumentText). Doesn't matter. Either way it's truncated before the clipboard is even invoked.
    Try saving it as an object or picture, even. I'm thinking EOF characters. It isn't XML, is it?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    No, it's not XML. However, it actually seems as though DocumentText has a character limit. If I just set it to write to a text file, it still is truncated.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  10. #10
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,961

    Re: WebBrowser.DocumentText

    Whereby an IMAGE wouldn't have the same limit...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    But, an image would defeat the purpose. I need the webpage's full functionality. But, I am trying to change some text within it.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  12. #12
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,961

    Re: WebBrowser.DocumentText

    Can't you convert it back into text? It *should* be shorter, as well, when you display it in the browser.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #13
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    I think you're missing the point. I need the pages full functionality. That includes JavaScript and forms. There is no way to go from a screenshot back to the complete original code including scripts and forms.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  14. #14
    Join Date
    Jun 2004
    Location
    NH
    Posts
    674

    Re: WebBrowser.DocumentText

    There are converters out there, but I've never used them, so I don't know if it would work like that.

    When it gets tructated, have you counted the characters remaining?
    That may be a clue, that will help in the search for a documented limitation.

    I tried a few test runs, and I couldn't reproduce the problem.
    If you can give me a number(limit), then I can test it, by trying a larger number of characters here.
    A partial diagnosis can be made.
    If we match, then it's a control limitation, if not, then the limitation is local to your machine, for whatever reason.

  15. #15
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: WebBrowser.DocumentText

    Problem has been solved.

    I was doing a dumb thing. I just realized that I was trying to evaluate the DocumentText property when the title changed, not when the document was completed.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center