WebBrowserNavigatingEventArgs.TargetFrameName Proprietà

Definizione

Ottiene il nome del frame della pagina Web nel quale verrà caricato il nuovo documento.

public:
 property System::String ^ TargetFrameName { System::String ^ get(); };
public string TargetFrameName { get; }
public string? TargetFrameName { get; }
member this.TargetFrameName : string
Public ReadOnly Property TargetFrameName As String

Valore della proprietà

Nome del frame nel quale verrà caricato il nuovo documento.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro. Nell'esempio un gestore eventi segnala l'occorrenza dell'evento WebBrowser.Navigating . Questo report consente di apprendere quando si verifica l'evento e può essere utile per il debug. Per segnalare più eventi o eventi che si verificano di frequente, provare a sostituire MessageBox.Show o Console.WriteLine accodare il messaggio a un oggetto multilinea TextBox.

Per eseguire il codice di esempio, incollarlo in un progetto contenente un'istanza di tipo WebBrowser denominata WebBrowser1. Assicurarsi quindi che il gestore eventi sia associato all'evento WebBrowser.Navigating .

private void WebBrowser1_Navigating(Object sender, WebBrowserNavigatingEventArgs e) {

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

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

End Sub

Si applica a

Vedi anche