WebBrowserNavigatedEventArgs.Url プロパティ

定義

WebBrowser コントロールの移動先であるドキュメントの場所を取得します。

public:
 property Uri ^ Url { Uri ^ get(); };
public Uri Url { get; }
public Uri? Url { get; }
member this.Url : Uri
Public ReadOnly Property Url As Uri

プロパティ値

Uri

Uri コントロールの移動先ドキュメントの場所を表す WebBrowser

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーによってイベントの発生が WebBrowser.Navigated 報告されます。 このレポートは、イベントがいつ発生するかを学習するのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントに関するレポートを作成するには、メッセージを複数行TextBoxConsole.WriteLine置き換えるかMessageBox.Show追加することを検討してください。

コード例を実行するには、名前付きのWebBrowser1WebBrowserのインスタンスを含むプロジェクトに貼り付けます。 次に、イベント ハンドラーがイベントに WebBrowser.Navigated 関連付けられていることを確認します。

private void WebBrowser1_Navigated(Object sender, WebBrowserNavigatedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Url", e.Url );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Navigated Event" );
}
Private Sub WebBrowser1_Navigated(sender as Object, e as WebBrowserNavigatedEventArgs) _ 
     Handles WebBrowser1.Navigated

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Url", e.Url)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Navigated Event")

End Sub

適用対象