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 6096429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:55:34+00:00 2026-05-23T12:55:34+00:00

My application fetches data from a live feed, processes it and displays the results.

  • 0

My application fetches data from a live feed, processes it and displays the results. This data is updated every 5 seconds. In the Load event of Main form I’ve created a thread to show the splash screen which is shown until the first data cycle is run .

The data fetching and processing thread (RecieverThread) calls RecieveFeed. The isue I’m facing is that form2 which displays data fetched in RecieveFeed is shown before the first cycle is run completely. How do I ensure that form2 is loaded only after the first cycle has completed fetching data.

Code in the Main form:

    private void frmMain_Load(object sender, EventArgs e)
    {
      Hide();

      // Create a new thread from which to start the splash screen form
      Thread splashThread = new Thread(new ThreadStart(StartSplash));
      splashThread.Start();

     //Thread to call the live feed engine. This thread will run for the duration of application
      ReceiverThread = new System.Threading.Thread(new System.Threading.ThreadStart(ReceiveFeed));
      ReceiverThread.Start();
      frmSecondForm form2 = new frmSecondForm();
      form2.MdiParent = this;
      form2.WindowState = FormWindowState.Maximized;
      Show();
      form2.Show();
    }   

    public frmRaceRace()
    {
        InitializeComponent();
        this.splash = new SplashScreen();
    }

    private void StartSplash()
    {
        splash.Show();
        while (!done)
        {
            Application.DoEvents();
        }
        splash.Close();
        this.splash.Dispose();

    }

    private void ReceiveFeed()
    {   

      while (!StopReceivingData)                    
      {
        foreach (...)
        {
         //Fetches data from live engine
         DLLImportClass.GetData1();
         //Manipulates and stores the data fetched in datatables                              
         ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { StoreData(); }))
         rowsProcessed++;
         if (!done)
         {
          this.splash.UpdateProgress(100 * rowsProcessed / totalRows);
         }
        } 

       done = true;        
       Thread.Sleep(5000);
     }
    }
  • 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-23T12:55:35+00:00Added an answer on May 23, 2026 at 12:55 pm

    I think what you need to use here is System.Threading.AutoResetEvent. Basically, add a member of this to your form class:

    private AutoResetEvent waitEvent_ = new AutoResetEvent(false); // create unininitialized
    

    After showing your splash, you want to wait for this event to be signalled:

    private void StartSplash()
    {
        splash.Show();
        // this will time out after 10 seconds.  Use WaitOne() to wait indefinitely.
        if(waitEvent_.WaitOne(10000))
        {
            // WaitOne() returns true if the event was signalled.
        }
    
    } // eo StartSplash
    

    Finally, in your processing function, when you’re done, simply call:

    waitEvent_.Set();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an application that works like this: It fetches data from
I have created an iPhone application which fetches data held on a server in
I've got a Windows Forms Application that does some data fetching from various places.
Hello I am working on getting data from database by sending a piece of
I want to generate a web component from an existing PowerBuilder application. I may
This is a tricky one to explain (and very weird), so bear with me.
I have to store messages that my web app fetch from Twitter into a
Greetings collective, I am new to Cocoa and have been tasked with working on
Let's say I've got a SQL 2008 database table with lots of records associated
I will try to narrate the problem in simple words. I am fairly new

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.