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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:11:57+00:00 2026-06-03T19:11:57+00:00

In the UI thread I have a piece of code that goes like this:

  • 0

In the UI thread I have a piece of code that goes like this:

SomeForm form = new SomeForm();
(...)
form.Show();

SomeForm class particularly has a System.Windows.Forms.Timer instance as a member that is being initialized by auto-generated code of InitializeComponent() that looks like this:

this.UploadStatusTimer.Enabled = true;
this.UploadStatusTimer.Interval = 1000;
this.UploadStatusTimer.Tick += new System.EventHandler(this.UploadStatusTimer_Tick);

form.Show() will in the end raise Form.Load event that is being handled by SomeForm_Load(object sender, EventArgs e).

My question is: is there a possibility that UploadStatusTime_Tick was being processed before SomeForm_Load?

  • 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-03T19:11:58+00:00Added an answer on June 3, 2026 at 7:11 pm

    What you are asking is “can it take longer than one second from the time I construct my form for the Load event to fire?”

    Beyond the theoretical answer of “yes, this is always possible” it really comes down to how long (…) takes in your example code. The timer is going to start counting down as soon as Enabled is set to true (when it is constructed).

    It’s important to note that UI interactions are processed via a message pump. So thinking of the winforms timer, the timer itself is off running in the background (outside of .net even; it is using the native windows timer) and when the timer expires it sends a message to your application, which then queues a message on the message pump that says “hey, timer tick happened.” Same thing applies to your form load event, it is triggered via a message on the message pump. So if the timer expires before the form “loads” then the timer message will be in front of the ‘form load’ message on the queue and get processed first.

    If you’re interested in learning more, there many articles or stack overflow questions on the winforms message pump (or message loop as some may call it).

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

Sidebar

Related Questions

I have a piece of code which looks like this: Snippet A: class Creature
I have this piece of code in my application. I suspect that it is
In JCIP we have a piece of code which looks like this: Listing 4.2:
I have this piece of code in a secondary thread: DWORD result = WaitForSingleObject(myhandle,10000);
I have the following code piece for a console application that I would like
I have a thread in my application that is running code that can potentially
I have this piece of code as part of a socks5 proxy server implementation.
I have time-critical piece of code in my app. I made the thread which
We have the following piece of code (idea for this code was found on
So, I have this piece of code, which will just read the message from

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.