GenZiy
GenZiy

Reputation: 1447

How to close Find window in a webbrowser control

I use a WebBrowser control and it's find functionality:

    private void findToolStripMenuItem_Click(object sender, EventArgs e)
    {
        webBrowser1.Select();
        SendKeys.Send("^f");
    }

Which works fine. Only problem that there is a case when user can make WebBrowser unvisible to perform some other tasks:

webBrowser1.Visible = false;

But Find window remains visible. Any suggestions? Thank you.

Upvotes: 2

Views: 1485

Answers (1)

Bala R
Bala R

Reputation: 108957

To close, try this

        webBrowser1.Select();
        SendKeys.Send("^f");
        SendKeys.Send("{ESCAPE}");

There is no easy/direct way to control the Find dialog. One way to close the Find dialog is by sending "ESCAPE" to the dialog when it has focus. If you send "^f" prior to sending "ESCAPE", that will force the find dialog to get focus.

Upvotes: 3

Related Questions