Home » VB.Net

progamming to scroll a web page automatically using visual basic webbrowser control

I am navigating to a website using a webbrowers control and I wish to automatically scroll the page after it is loaded.

I have used scrolltop , scrollleft commands as set out below but nothing seems to happen.

 WebBrowser1.Document.Body.ScrollTop = 100
 WebBrowser1.Document.Body.ScrollLeft = 200

I have placed the above commands in a command button and wait until the page has loaded before I press it and also in the

 WebBrowser1_DocumentCompleted sub


other commands such as



seem to work ok


some help is appreciated







1 Answer Found


Answer 1

Well I think the way you implement is wrong.

e.g.) if i have a image ("image1") and my motto is bring to view then i should call as


If you need the distance between the top of the visual page  and the image to be 50 px then you have to set  as

document.getElementById("image1").scrollTop = 50;


If you are trying to set for body, you might not get any result as the whole page would be a body



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure