PC Review


Reply
Thread Tools Rate Thread

Cannot find WebBrowser.Find

 
 
rossum
Guest
Posts: n/a
 
      10th Mar 2005
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
 
Reply With Quote
 
 
 
 
Carl Daniel [VC++ MVP]
Guest
Posts: n/a
 
      10th Mar 2005
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


 
Reply With Quote
 
 
 
 
Tim Anderson
Guest
Posts: n/a
 
      10th Mar 2005
"rossum" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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



 
Reply With Quote
 
rossum
Guest
Posts: n/a
 
      12th Mar 2005
On Thu, 10 Mar 2005 20:17:04 -0000, "Tim Anderson"
<(E-Mail Removed)> wrote:

>"rossum" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>
>> 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
 
Reply With Quote
 
rossum
Guest
Posts: n/a
 
      13th Mar 2005
On Wed, 09 Mar 2005 23:38:24 +0000, rossum <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot find server; cannot find page =?Utf-8?B?TGl6IFdpbGRmbG93ZXI=?= Windows XP Internet Explorer 2 25th Oct 2006 03:53 AM
Find and Advanced Find Feature cannot find any data in outlook =?Utf-8?B?VGVycmkgU2Nob2VybmVy?= Microsoft Outlook Discussion 0 30th Jan 2006 08:19 PM
Find first, find 2nd, find 3rd, etc. =?Utf-8?B?VmVybm9u?= Microsoft Access VBA Modules 4 22nd Jul 2005 12:22 AM
cannot find server; cannot find search engine jeff rippe Windows XP Internet Explorer 1 13th Jan 2004 05:26 PM
Help: cannot find boot.ini, then cannot find operating system wbutterfly Microsoft Windows 2000 Setup 1 17th Sep 2003 08:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:38 PM.