Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ScrollTop doesn't scroll my webpage

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
I'm using a WebBrowser object to display a webpage and I want to scroll the page down using VB.

For some webpages I can say WebBrowser1.Document.Body.scrollTop = 200 and it'll scroll down 200 pixels. However, on some webpages this does nothing even though the page is pretty long and could scroll down (eg scrollHeight returns 3000).

In these instances when I set scrollTop and then read scrollTop it's always zero.

Can anyone suggest a reason why the page might not scroll down?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
I found a solution, but I can't explain why the original solution works for some webpages and not others, perhaps someone can explain?

Anyway, the solution is:

WebBrowser1.Document.parentWindow.ScrollTo 0, 200

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top