Posted By: Shark_M | Jan 23rd, 2006 @ 11:34 PM
page 1 of 1
Comments: 4 | Views: 2748
Hi guys,
I have a webbrowser control in my windows form and when I append a large text into it, the vertical scroller, goes down and then up to about halfway the scrolling area

here is the code that appends it
Public Function AddToHTML(ByVal Browser As WebBrowser, ByVal HTMLMsg As String) As Boolean

With Browser.Document.Body
                    .InnerHtml = String.Concat(.InnerHtml, "<small>", HTMLMsg, "</small><br>")
                .ScrollTop = CInt(.InnerHtml.Length() * 1000)
                .ScrollIntoView(False)
 End With


so why does it not show the last added message?
Yeah, I'm having this same problem.  How can I make new content in the WebBrowser scroll to put it into view?  I have an HTML log file that I wish to show in real time.  What's at the bottom is what is relevant.
littleguru
littleguru
<3 Seattle
I have created a sample Windows Forms application and added a webbrowser control + button to the form... To the Click event handler I added the following code and it works great - always scrolls down to the very end.

        private void button1_Click(object sender, EventArgs e)

        {

            webBrowser1.Document.Body.InnerHtml += "<br>item " + Guid.NewGuid().ToString();

            webBrowser1.Document.Body.ScrollTop = int.MaxValue;

        }

This works, thanks.  Just be careful with CSS formatting with white-space: pre, and using <DIV> or <SPAN> tags with carriage returns in them.

So far, your reply works the best.  All a finicky to some degree due to the IE rendering engine.
What if I want to search for a word in my page, and then if the word in present, i want the webbrowser to go to that place?
page 1 of 1
Comments: 4 | Views: 2748
Microsoft Communities