So i have looked at several other posts on stackoverflow and none of them seem to be working for me to accomplish this. All I want to do is for the WebBrowser control to automatically scroll down to the very bottom after I change something programmatically in the webbrowser1.documenttext property.
I've tried ALL of the following ways, and none of them work... I actually have them literally all in the exact same line of code.
WebBrowser1.ScrollBarsEnabled = True
WebBrowser1.Document.Body.ScrollIntoView(False)
WebBrowser1.Document.Window.ScrollTo(New Point(WebBrowser1.Height, WebBrowser1.Height))
WebBrowser1.Document.Window.ScrollTo(WebBrowser1.Height, WebBrowser1.Height)
WebBrowser1.AutoScrollOffset = New Point(WebBrowser1.Height, WebBrowser1.Height)
In my WebBrowser1 control all I have done is set started it with and then at the end placed and in the middle all i've done is copied 'n pasted the following...
<html><body>
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
<div style="color: red;">blah blah</div><Br />
</body></html>
about 30 times... BUT I can't get anything to work. None of the code above is doing anything.
What am I missing?
VS 2005 SP1 - VB.NET
Your problem may be you are trying to access the DOM before it is updated. Fire your code to scroll the correct element into view in the DocumentCompleted event, like this: