471,349 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Cannot find WebBrowser.Find

I am using Visual C# Express Beta, though I suspect that my question
has more to do with .NET than with C# specifically. I have written a
form with a Web Browser in it. At the top I have a button bar. What
I want to do is to have a [Find] button which searches for
user-entered text in the HTML document in the Web Browser.

When I run my form I can type Ctrl-F and up comes a standard Find
dialogue box which does exactly what I want - the dialogue is
presumably built into the Web Browser as I certainly didn't put it
there. My problem is that I cannot find a way to trigger this Find
dialogue programatically so I can hook it into my [Find]. I have
looked through all the WebBrowser members and also through the
WebBrowser.Document members - no joy. Neither can I find a KeyPress
event attached to the WebBrowser so I could generate an internal
Ctrl-F to set things off.

If I have to I can code my own Find dialogue, but I would rather not
do this given that there is obviously one already built into the Web
Browser.

Does anyone have any thoughts as to ways to fire up the Web Browser's
Find dialogue programatically?

Thanks

rossum

--

The ultimate truth is that there is no Ultimate Truth
Jul 21 '05 #1
4 3051
rossum wrote:
I am using Visual C# Express Beta, though I suspect that my question
has more to do with .NET than with C# specifically.


You should post to microsoft.public.dotnet.languages.csharp and/or
microsoft.private.whidbey.csharp.language. This group (.vc.language) is a
C++ group.

-cd
Jul 21 '05 #2
"rossum" <ro******@coldmail.com> wrote in message
news:a1********************************@4ax.com...
Does anyone have any thoughts as to ways to fire up the Web Browser's
Find dialogue programatically?


In the HtmlEditor (http://www.itwriting.com/htmleditor/index.php) I do this
by casting the HTMLDocument to IOleCommandTarget and then calling exec with
IDM_FIND for the argument. This should work for the WebBrowser control too;
you could take a look at the code. Maybe there's an easier way, I'm not
sure.

Tim
How much memory does my .NET application use?
http://www.itwriting.com/dotnetmem.php

Jul 21 '05 #3
On Thu, 10 Mar 2005 20:17:04 -0000, "Tim Anderson"
<ti*****@hotmail.com> wrote:
"rossum" <ro******@coldmail.com> wrote in message
news:a1********************************@4ax.com.. .
Does anyone have any thoughts as to ways to fire up the Web Browser's
Find dialogue programatically?


In the HtmlEditor (http://www.itwriting.com/htmleditor/index.php) I do this
by casting the HTMLDocument to IOleCommandTarget and then calling exec with
IDM_FIND for the argument. This should work for the WebBrowser control too;
you could take a look at the code. Maybe there's an easier way, I'm not
sure.

Tim
How much memory does my .NET application use?
http://www.itwriting.com/dotnetmem.php

Thanks Tim and Carl for the suggestions.

rossum
--

The ultimate truth is that there is no Ultimate Truth
Jul 21 '05 #4
On Wed, 09 Mar 2005 23:38:24 +0000, rossum <ro******@coldmail.com>
wrote:

[snip question]
Does anyone have any thoughts as to ways to fire up the Web Browser's
Find dialogue programatically?

Thanks

rossum


Thanks to Alexander Shirsov on
microsoft.public.dotnet.languages.csharp I now have a solution:

webBrowser.Focus();
SendKeys.Send("^f");

That is in C#. I presume that the C++ solution will be similar to:

webBrowser->Focus();
SendKeys->Send("^f");

(Warning: C++ code not tested.)

rossum

--

The ultimate truth is that there is no Ultimate Truth
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Orantas Gladkauskas | last post: by
4 posts views Thread by rossum | last post: by
5 posts views Thread by SPE - Stani's Python Editor | last post: by
12 posts views Thread by Alex Clark | last post: by
reply views Thread by jan.loucka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.