Click here to Skip to main content
15,917,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET 2.0's WebBrowser control Pin
Heath Stewart9-Jul-04 9:11
protectorHeath Stewart9-Jul-04 9:11 
Generalimplement a own shell-view Pin
Shir Khan9-Jul-04 5:23
Shir Khan9-Jul-04 5:23 
GeneralRe: implement a own shell-view Pin
Jesse Squire9-Jul-04 5:36
Jesse Squire9-Jul-04 5:36 
GeneralRe: implement a own shell-view Pin
Nick Parker9-Jul-04 6:00
protectorNick Parker9-Jul-04 6:00 
GeneralData layer DLL .Config Pin
Andy H9-Jul-04 4:58
Andy H9-Jul-04 4:58 
GeneralRe: Data layer DLL .Config Pin
Heath Stewart9-Jul-04 9:16
protectorHeath Stewart9-Jul-04 9:16 
GeneralFind on Page with IE browser control Pin
weekly_s9-Jul-04 4:47
weekly_s9-Jul-04 4:47 
GeneralRe: Find on Page with IE browser control Pin
Heath Stewart9-Jul-04 6:18
protectorHeath Stewart9-Jul-04 6:18 
If you haven't already, you'll need to interop MSHTML. If you've installed VS.NET, Microsoft.mshtml.dll should already be in the GAC. You just need to add a reference (this contains all the automation interfaces for the DOM).

Get the IHTMLDocument2 reference by casting WebBrowser.Document to the interface. Then get the body property (an IHTMLElement). Cast this to an IHTMLBodyElement and call createTextRange. This gives you an IHTMLTxtRange. You're almost done.

Call findText on the IHTMLTxtRange. Documentation for this method can be found in the Web Develoment -> Programming and Reusing the Browser section in MSDN Library[^]. If the text is found (it returns a bool), the IHTMLTxtRange is modified to beginand end with the text that was found. Then simply call scrollIntoView on the IHTMLTxtRange, passing either true or false to position the text at the top or bottom of the window, respectively.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Find on Page with IE browser control Pin
weekly_s9-Jul-04 7:55
weekly_s9-Jul-04 7:55 
GeneralRe: Find on Page with IE browser control Pin
Heath Stewart9-Jul-04 8:54
protectorHeath Stewart9-Jul-04 8:54 
GeneralLimiting the bandwidth Pin
pi_trek9-Jul-04 1:09
pi_trek9-Jul-04 1:09 
GeneralRe: Limiting the bandwidth Pin
Dave Kreskowiak9-Jul-04 6:07
mveDave Kreskowiak9-Jul-04 6:07 
GeneralRe: Limiting the bandwidth Pin
pi_trek10-Jul-04 3:54
pi_trek10-Jul-04 3:54 
GeneralRe: Limiting the bandwidth Pin
Dave Kreskowiak10-Jul-04 5:39
mveDave Kreskowiak10-Jul-04 5:39 
GeneralRe: Limiting the bandwidth Pin
pi_trek10-Jul-04 8:04
pi_trek10-Jul-04 8:04 
GeneralI would like to add programmatically a new element(c# or VB.NET) in the header of my aspx page. Pin
zoltix9-Jul-04 0:25
zoltix9-Jul-04 0:25 
GeneralRe: I would like to add programmatically a new element(c# or VB.NET) in the header of my aspx page. Pin
Colin Angus Mackay9-Jul-04 2:14
Colin Angus Mackay9-Jul-04 2:14 
GeneralRe: I would like to add programmatically a new element(c# or VB.NET) in the header of my aspx page. Pin
zoltix9-Jul-04 2:31
zoltix9-Jul-04 2:31 
GeneralDouble buffering Pin
Atlemann8-Jul-04 23:59
Atlemann8-Jul-04 23:59 
GeneralRe: Double buffering Pin
Heath Stewart9-Jul-04 4:18
protectorHeath Stewart9-Jul-04 4:18 
General2D Array modification Pin
saud_a_k8-Jul-04 23:59
saud_a_k8-Jul-04 23:59 
GeneralRe: 2D Array modification Pin
Heath Stewart9-Jul-04 3:57
protectorHeath Stewart9-Jul-04 3:57 
GeneralRe: 2D Array modification Pin
saud_a_k12-Jul-04 18:21
saud_a_k12-Jul-04 18:21 
GeneralRe: 2D Array modification Pin
saud_a_k12-Jul-04 21:32
saud_a_k12-Jul-04 21:32 
QuestionHow to add a button in the caption bar of a window Pin
bouli8-Jul-04 22:11
bouli8-Jul-04 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.