WebBrowser.GoSearch メソッド
定義
WebBrowser コントロールを現在のユーザーの既定の検索ページに移動します。Navigates the WebBrowser control to the default search page of the current user.
public:
void GoSearch();
public void GoSearch ();
member this.GoSearch : unit -> unit
Public Sub GoSearch ()
例外
この WebBrowser インスタンスは無効になっています。This WebBrowser instance is no longer valid.
IWebBrowser2
インターフェイスの実装への参照を、基になる ActiveX WebBrowser
コントロールから取得できませんでした。A reference to an implementation of the IWebBrowser2
interface could not be retrieved from the underlying ActiveX WebBrowser
control.
例
次のコード例では、GoSearch メソッドを使用して、Internet Explorer の WebBrowser コントロールに似た検索ボタンを実装する方法を示します。The following code example demonstrates how to use the GoSearch method to implement a Search button for the WebBrowser control similar to the one in Internet Explorer. この例では、フォームに webBrowser1
と呼ばれる WebBrowser コントロールと ButtonSearch
と呼ばれる Button コントロールが含まれている必要があります。This example requires that your form contains a WebBrowser control called webBrowser1
and a Button control called ButtonSearch
.
完全なコード例については、「方法: Windows フォームアプリケーションに Web ブラウザーの機能を追加する」を参照してください。For the complete code example, see How to: Add Web Browser Capabilities to a Windows Forms Application.
// Navigates WebBrowser1 to the search page of the current user.
void ButtonSearch_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
this->WebBrowser1->GoSearch();
}
// Navigates webBrowser1 to the search page of the current user.
private void searchButton_Click(object sender, EventArgs e)
{
webBrowser1.GoSearch();
}
' Navigates webBrowser1 to the search page of the current user.
Private Sub searchButton_Click( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles searchButton.Click
webBrowser1.GoSearch()
End Sub
注釈
この方法を使用すると、Internet Explorer の場合と同様の検索機能を実装できます。You can use this method to implement a search feature similar to the one in Internet Explorer. インストールされている Internet Explorer のバージョンに応じて、ユーザーは [インターネットオプション] ダイアログボックスで既定の検索ページを指定できます。このページは、internet explorer の コントロールパネル または [ツール] メニューから使用できます。Depending on the version of Internet Explorer installed, the user can specify a default search page in the Internet Options dialog box, which is available from Control Panel or from the Tools menu in Internet Explorer.
既定の検索ページは、レジストリの HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Search Page
レジストリキーの下に格納されます。The default search page is stored in the registry under the HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Search Page
registry key. Internet Explorer の新しいバージョンでは、このメソッドで使用される既定の検索ページを変更するために、このレジストリキーを変更する必要があります。With later versions of Internet Explorer, this registry key must be modified in order to change the default search page used by this method. 既定以外の検索ページを使用するには、Navigate メソッドを呼び出すか、Url プロパティを指定します。To use a search page other than the default, call the Navigate method or specify the Url property.
セキュリティ
SecurityPermission
直前の呼び出し元がこのコントロールを使用できるようにします。for immediate callers to use this control. 要求の値: LinkDemand;名前付きアクセス許可セット: FullTrust
。Demand value: LinkDemand; Named Permission Sets: FullTrust
.