Reputation: 649
How to get the URI from webbrowser in listbox?? this code add a 20 URI not 1:
private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
radListControl1.Items.Add(webBrowser1.Url.AbsoluteUri.ToString());
}
or
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
radListControl1.Items.Add(webBrowser1.Url.AbsoluteUri.ToString());
}
Upvotes: 2
Views: 488
Reputation: 14591
you need to check the URI provided by the event against the one in browser:
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (e.Url.Equals(webBrowser1.Url))
// this is the real one
}
EDIT: actually, it has already been answered.
Upvotes: 1
Reputation: 376
if (!radListControl1.Items.Contains(webBrowser1.Url.ToString()))
radListControl1.Items.Add(webBrowser1.Url.ToString());
Because this event is fired multiple times in single page load...
Upvotes: 1