Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4097824
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:13:23+00:00 2026-05-20T20:13:23+00:00

I have one method. You can even test it: private readonly public HtmlDocument Browse()

  • 0

I have one method. You can even test it:

 private readonly 
    public HtmlDocument Browse()
    {
        var _browser = new WebBrowser();
        var link = "http://hotline.ua/sr/?q=allo";
        var loadFinished = false;

        _browser.DocumentCompleted += delegate { loadFinished = true; };
        try
        {
            _browser.Navigate(link);
        }
        catch (Exception xx)
        {
            if (!(xx is UriFormatException))
                throw;

            loadFinished = false;
        }

        while ( ! loadFinished  )
            Thread.Sleep(50);

        loadFinished = false;

        return _browser.Document;
    }

Then somewhere in code I call this method:

var doc = Browse();

Instead of getting a HtmlDocument I get to the infinite loop in :

 while ( ! loadFinished  )
            Thread.Sleep(50);

It seems that DocumentCompleted is never fired. But in Web browser I can easily to get this page.
Anybody knows why ? And what should I do to get a HtmlDocument ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:13:23+00:00Added an answer on May 20, 2026 at 8:13 pm

    Oh sorry. I found a solution, after I post this topic:

    That the reason why this event not fired:

    I should not use

    Thread.Sleep(50);
    

    Because the event fired earlier and freed resourses. So thread get killed before it hits the document completed method.

    If I change for:

    Application.DoEvents();
    

    It becomes work perfectly.

    Thanks for you replies also !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class which have one public method Start , one private method and
In UML sequence diagram a method can have only one return line (at least
I'm creating a class that will have one public method, which returns a value
Can somebody explain me one thing. I have two methods in my controller :
I have one method that opens a file and passes off to another function
I have one method in my managed bean which returns javascript as a string.
I have one method with one letter(string\char?) as argument and one word active at
I have one combobox on the window form and I have one method which
I have a project with a lot of panels. I have one method that
i have one setinterval method which call php script every 3 sec to check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.