tags:

views:

662

answers:

2

How to scroll to the location of any text automatically in the WebBrowser control in C#. Lets say, I way to scroll to the third instance of the word "ABCD" in the webbrowser control, how to do that? I can identify the location, but how to scroll to that word, or convert that word location in innerText to Point location in Browser screen.

+1  A: 

You'd have to point the browser to the nearest element with an ID-attribute, by adding #yourelement to the URL.

Example: http://example.org/content/yourpage.aspx#aboutUs

Would open the page and scroll directly to the element with an ID attribute with value "aboutUs".

Arve Systad
Can't put a reference anchor for text word, also can't load the document one more time. I just wan't to scroll to the text cursor. Scrolling part is easy, but how to get the text position.
Priyank Bolia
A: 

Firefox has methods to do the same: ScrollToElement.

Priyank Bolia