0

How can I build my own search function for the webbrowser control, and if possible remove the built-in one (CTRL + F find function, that is)? Any help regarding this would be appreciated.

Edit - How would I search for text and select it? Pretty much like how the find dialog will find text and select it, I want to do that and I have messed with the document property of the page but I still can't get it to work. Any help?

david
  • 357
  • 2
  • 7
  • 18

1 Answers1

0

That is the purpose of the WebBrowser control.

There are third party browser controls you can use instead:


Update (following comments):

You can capture the KeyPress events of the control to find out if ctrl+f was pressed, then use your own search algorithm on the document returned by the control.

I expect you should be able to do something similar with the third party controls as well.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Hmm, while those are nice I feel that they would be too resource intensive for my application. I was wondering how I could code my own search function in the web browser (and replacing the old one) seeing as that is all I want to modify in the web browser control. Any idea how I would do this? – david Nov 08 '10 at 14:47
  • @david - I don't really understand what you are trying to achieve. Are you talking about an existing web browser? Do you mean something like the different IE search providers or the list of search providers that exists in firefox? – Oded Nov 08 '10 at 14:56
  • I will rephrase it. With the webbrowser control, I want my own search feature (and not the one that shows up when you press CTRL + F). How would I programatically search and select text in the web page? – david Nov 08 '10 at 15:24
  • @david - just to see if I understand correctly. You want to override the textual page search built into the browser? – Oded Nov 08 '10 at 15:38
  • Yes, but if that is not possible (or is too complicated), then just building my own search function would be okay. – david Nov 08 '10 at 15:40
  • @david - can you update your question and clarify it for others, in that case? Comments on an answer may end up not being read... – Oded Nov 08 '10 at 15:42
  • The KeyPress event doesn't exist, but I found a work around for that, checking input in the PreviewKeyDown event and I didn't seem to have any problems. I do have a problem however with selecting text though. – david Nov 08 '10 at 17:52