|
When opening dozens of WebBrowser at the same time, they did not call their show () method. Why sometimes WebBrowser automatically displays WebBrowser when it fails to open a web page, and sometimes it does not?
Called code:
for (int j = pageStartNum; j <pageStartNum + loopCount; j ++)
{
HTMLAnalysis htmAnalysis = new HTMLAnalysis ();
string url = websiteURL + "&" + subURL + "=" + currIndustryCode + "&" + paginationFalg + "=" + j;
htmAnalysis.startProcess (url);
htmAnalysis = null;
Thread.Sleep (500);
}
class HTMLAnalysis code:
try
{
Uri uri = new Uri (url);
page.ScriptErrorsSuppressed = true;
page.Navigate (uri);
page.Left = -page.Width;
page.DocumentCompleted + = new WebBrowserDocumentCompletedEventHandler (Process);
}
catch (Exception ex)
{
DisplayMessage (ex.ToString ());
}
private void Process (object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (page.ReadyState == WebBrowserReadyState.Complete)
{
try
{
******************
}
catch (Exception ex)
{
HTMLAnalysis.failCount ++;
MessageBox.Show (ex.Message);
}
finally
{
page.Controls.Clear ();
page.Dispose ();
page = null;
}
}
Is it a problem with dispose (), has anyone encountered this situation? |
|