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

  • SEARCH
  • Home
  • 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 7975859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:45:37+00:00 2026-06-04T08:45:37+00:00

In my C# application I start the program up by reading a HTML page

  • 0

In my C# application I start the program up by reading a HTML page and parsing some links out of it and putting them into a richTextBox (for now). But the problem is, that because it has to read the links it takes some time, so when I start the program it takes about 5 seconds before the form is shown. What I would like to do is show the form immediately, and show a loading cursor or a disabled richTextBox. How would I go about doing that? Here is a sample of what happens:

public Intro()
        {
            InitializeComponent();
            WebClient wc = new WebClient();
            string source = wc.DownloadString("http://example.com");

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(source);
            var nodes = doc.DocumentNode.SelectNodes("//a[starts-with(@class, 'url')]");
            foreach (HtmlNode node in nodes)
            {
                HtmlAttribute att = node.Attributes["href"];
                richTextBox1.Text = richTextBox1.Text + att.Value + "\n";

            }

        }
  • 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-06-04T08:45:39+00:00Added an answer on June 4, 2026 at 8:45 am

    OK, a little (I hope it’s all correct) sample how you could do it with Task Parallel Library (What? I like it…)

    public Intro()
    {
        InitializeComponent();
    
        richTextBox1.IsEnabled = false;
        Task.Factory.StartNew( () =>
        {
           WebClient wc = new WebClient();
           string source = wc.DownloadString("http://example.com");
    
           HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
           doc.LoadHtml(source);
           var nodes = doc.DocumentNode.SelectNodes("//a[starts-with(@class, 'url')]");
           return nodes;
        }).ContinueWith( result =>
        {
          richTextBox1.IsEnabled = true;
    
          if (result.Exception != null) throw result.Exception;
    
          foreach (var node in result.Result)
          {
               HtmlAttribute att = node.Attributes["href"];
               richTextBox1.Text = richTextBox1.Text + att.Value + "\n";
          }
    
        }, TaskScheduler.FromCurrentSynchronizationContext());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which will start a program flow with the arrival of
I have created some application, which is reading from System.in using the following method:
In my application presently when the user selects Start program automatically in my options,
I have a winforms application.Winforms start with Program.cs where we have main() defined.I have
On application start I'm creating Config object (Singleton). How could I make Config object
My idea is to make an application start automatically when a message from a
I wrote these lines in My Application start event: var mongo = new Mongo();
In my Silverlight application, I load all the images I need at application start
i am implementing one graph related app. In that when application start i am
In my application I start a worker thread from a custom user control. When

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.