| |

VerySource

 Forgot password?
 Register
Search
View: 620|Reply: 7

Help: When dozens of WebBrowser are opened at the same time, the show method is not displayed but it is automatically di

[Copy link]

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-9 23:20:01
| Show all posts |Read mode
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?
Reply

Use magic Report

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-11 10:54:02
| Show all posts
page is a WebBrowser object
WebBrowser page = new WebBrowser () defined in HTMLAnalysis class;
Reply

Use magic Report

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-11 19:18:02
| Show all posts
Top yourself: don't sink.

How come no master has come.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-13 11:27:01
| Show all posts
Did you originally want to read the webpage using WebBrowser without the interface being displayed, but the interface was occasionally displayed again?
Reply

Use magic Report

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-13 14:18:01
| Show all posts
Yes, that's it.
What should I do?
Reply

Use magic Report

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-14 16:54:01
| Show all posts
Is it because htmAnalysis = null was called?

?

When page.DocumentCompleted + = new WebBrowserDocumentCompletedEventHandler (Process);
When the called Process () has not been executed yet, htmAnalysis is null?
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-18 06:15:01
| Show all posts
up
Reply

Use magic Report

1

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-3 20:45:02
| Show all posts
The problem has been solved is the problem of dispose().
It is strange that if the webbrowser fails to open the website, this problem will occur in dispose.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list