manish patel
manish patel

Reputation: 1449

How to open webpage in WebBrowser control in a loop

I am using a WebBrowser control in my application.

I have URLs of websites in a list, and I want to open them one by one in my web browser control using C#.

Upvotes: 0

Views: 311

Answers (3)

Wayne Hamberg
Wayne Hamberg

Reputation: 41

foreach (string str in hyperlinks) works however the problem is the answer won't give you the result you want.

  1. You need to wait for each document to complete first before you navigate to the next document. The foreach statement will load each document but the only document that will fully load will be the last document.
  2. You need to ingore the Java Script errors as this creates numerous exceptions in the WebBrowser component.

Upvotes: 0

David Rutten
David Rutten

Reputation: 4806

WebBrowser.Navigate(); ?

Upvotes: 0

Tony The Lion
Tony The Lion

Reputation: 63240

here you go:

List<string> hyperlinks = new List<string>();

foreach (string str in hyperlinks)
{

mybrowser.Navigate(str);

}

Upvotes: 1

Related Questions