WebBrowser.Navigated イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebBrowser.Navigated イベントの意味・解説 

WebBrowser.Navigated イベント

メモ : このイベントは、.NET Framework version 2.0新しく追加されたものです。

WebBrowser コントロール新しドキュメント移動しドキュメント読み込み開始したときに発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Event Navigated As
 WebBrowserNavigatedEventHandler
Dim instance As WebBrowser
Dim handler As WebBrowserNavigatedEventHandler

AddHandler instance.Navigated, handler
public event WebBrowserNavigatedEventHandler Navigated
public:
event WebBrowserNavigatedEventHandler^ Navigated {
    void add (WebBrowserNavigatedEventHandler^ value);
    void remove (WebBrowserNavigatedEventHandler^ value);
}
/** @event */
public void add_Navigated (WebBrowserNavigatedEventHandler
 value)

/** @event */
public void remove_Navigated (WebBrowserNavigatedEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

Navigated イベントハンドラ使用して WebBrowser コントロールアドレス バー実装する方法次のコード例示します。この例では、webBrowser1 という名前の WebBrowser コントロールTextBoxAddress という名前の TextBox コントロール、および ButtonGo という名前の Button コントロールフォーム含まれていることを前提としています。テキスト ボックスURL入力しEnter キーを押すか [移動] ボタンクリックすると、WebBrowser コントロールが、指定されURL移動しますハイパーリンククリックして移動した場合テキスト ボックス自動的に更新され現在の URL表示されます。

コード全体については、「方法 : Windows フォーム アプリケーションWeb ブラウザ機能追加する」を参照してください

' Navigates to the URL in the address box when 
' the ENTER key is pressed while the ToolStripTextBox has focus.
Private Sub toolStripTextBox1_KeyDown( _
    ByVal sender As Object,
 ByVal e As KeyEventArgs) _
    Handles toolStripTextBox1.KeyDown

    If (e.KeyCode = Keys.Enter) Then
        Navigate(toolStripTextBox1.Text)
    End If

End Sub

' Navigates to the URL in the address box when 
' the Go button is clicked.
Private Sub goButton_Click( _
    ByVal sender As Object,
 ByVal e As EventArgs) _
    Handles goButton.Click

    Navigate(toolStripTextBox1.Text)

End Sub

' Navigates to the given URL if it is valid.
Private Sub Navigate(ByVal
 address As String)

    If String.IsNullOrEmpty(address) Then
 Return
    If address.Equals("about:blank")
 Then Return
    If Not address.StartsWith("http://")
 And _
        Not address.StartsWith("https://")
 Then
        address = "http://" & address
    End If

    Try
        webBrowser1.Navigate(New Uri(address))
    Catch ex As System.UriFormatException
        Return
    End Try

End Sub

' Updates the URL in TextBoxAddress upon navigation.
Private Sub webBrowser1_Navigated(ByVal
 sender As Object, _
    ByVal e As WebBrowserNavigatedEventArgs)
 _
    Handles webBrowser1.Navigated

    toolStripTextBox1.Text = webBrowser1.Url.ToString()

End Sub
// Navigates to the URL in the address box when 
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object
 sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        Navigate(toolStripTextBox1.Text);
    }
}

// Navigates to the URL in the address box when 
// the Go button is clicked.
private void goButton_Click(object sender,
 EventArgs e)
{
    Navigate(toolStripTextBox1.Text);
}

// Navigates to the given URL if it is valid.
private void Navigate(String address)
{
    if (String.IsNullOrEmpty(address)) return;
    if (address.Equals("about:blank")) return;
    if (!address.StartsWith("http://")
 &&
        !address.StartsWith("https://"))
    {
        address = "http://" + address;
    }
    try
    {
        webBrowser1.Navigate(new Uri(address));
    }
    catch (System.UriFormatException)
    {
        return;
    }
}

// Updates the URL in TextBoxAddress upon navigation.
private void webBrowser1_Navigated(object sender
,
    WebBrowserNavigatedEventArgs e)
{
    toolStripTextBox1.Text = webBrowser1.Url.ToString();
}
// Navigates to the URL in the address text box when 
// the ENTER key is pressed while the text box has focus.
void TextBoxAddress_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^
 e )
{
   if ( e->KeyCode == System::Windows::Forms::Keys::Enter &&
  !this->TextBoxAddress->Text->Equals( ""
 ) )
   {
      this->WebBrowser1->Navigate( this->TextBoxAddress->Text
 );
   }
}

// Navigates to the URL in the address text box when 
// the Go button is clicked.
void ButtonGo_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{
   if (  !this->TextBoxAddress->Text->Equals(
 "" ) )
   {
      this->WebBrowser1->Navigate( this->TextBoxAddress->Text
 );
   }
}

// Updates the URL in TextBoxAddress upon navigation.
void WebBrowser1_Navigated( Object^ /*sender*/, System::Windows::Forms::WebBrowserNavigatedEventArgs^
 /*e*/ )
{
   this->TextBoxAddress->Text = this->WebBrowser1->Url->ToString();
}

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebBrowser クラス
WebBrowser メンバ
System.Windows.Forms 名前空間
WebBrowser.DocumentCompleted イベント
WebBrowser.DocumentStream プロパティ
WebBrowser.DocumentText プロパティ
GoBack
GoForward
GoHome
GoSearch
Navigate
Navigating
WebBrowser.Url プロパティ
WebBrowserNavigatedEventArgs
WebBrowserNavigatedEventHandler
その他の技術情報
イベント利用


このページでは「.NET Framework クラス ライブラリ リファレンス」からWebBrowser.Navigated イベントを検索した結果を表示しています。
Weblioに収録されているすべての辞書からWebBrowser.Navigated イベントを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からWebBrowser.Navigated イベント を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebBrowser.Navigated イベント」の関連用語

WebBrowser.Navigated イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebBrowser.Navigated イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS