Cannot find WebBrowser.Find

Discussion in 'Microsoft Dot NET' started by rossum, Mar 9, 2005.

  1. rossum

    rossum Guest

    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
     
    rossum, Mar 9, 2005
    #1
    1. Advertisements

  2. 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
     
    Carl Daniel [VC++ MVP], Mar 10, 2005
    #2
  3. rossum

    Tim Anderson Guest

    "rossum" <> wrote in message
    news:...

    > 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
     
    Tim Anderson, Mar 10, 2005
    #3
  4. rossum

    rossum Guest

    On Thu, 10 Mar 2005 20:17:04 -0000, "Tim Anderson"
    <> wrote:

    >"rossum" <> wrote in message
    >news:...
    >
    >> 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
     
    rossum, Mar 12, 2005
    #4
  5. rossum

    rossum Guest

    On Wed, 09 Mar 2005 23:38:24 +0000, rossum <>
    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
     
    rossum, Mar 12, 2005
    #5

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Sullivan

    Call a Script Function from a C# WebBrowser Application

    Michael Sullivan, Sep 22, 2003, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    489
    Michael Sullivan
    Sep 22, 2003
  2. Julien

    Webbrowser no longer works in .Net

    Julien, Jan 3, 2004, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    140
    Julien
    Jan 3, 2004
  3. Christoph

    Click into Webbrowser

    Christoph, Jan 5, 2004, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    178
    Christoph
    Jan 5, 2004
  4. Kenneth
    Replies:
    0
    Views:
    417
    Kenneth
    Jan 14, 2004
  5. Luis Ferrao
    Replies:
    1
    Views:
    2,763
    Guest
    Feb 8, 2004
Loading...

Share This Page