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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:24:00+00:00 2026-05-30T12:24:00+00:00

I want to do the following (c#) I have a Form,let’s call Form1 Form1

  • 0

I want to do the following (c#)

  • I have a Form,let’s call Form1
  • Form1 creates Form2
  • Form2’s constructor is executed (GUI,variables..). Last instructions of Form2 are: create and show Form3
  • Form2 contains Label1
  • Form2 creates Form3 and pass a reference of itself to Form3
  • Form3 edit label1(of Form2) many times (let’s say 100)

This is ok..all working but..
The problem is: Form3 takes a long time to run all operations (let’s 10 seconds). In the end(at the SAME time) Form2 and Form3 are both shown but I want Form2 is visible BEFORE Form3,because I want which,while Form3 operations are executed (including editing label1 on Form2),Form2 show each update of Label1 (like “Doing: operation 1”,then “Doing: operation 2” and so on..).

I also tried to make a button (Button1) on Form2,defining Button1_onClick() event and fulfilling its content with “create and show Form3”.
But when I click Button1,Form2 “disappears”(like when a Windows application is blocked and it becomes “paused”) and it show just the final label (“Operation: 100”) in the same moment which appears Form3.

Summary of my question:
–> I have 3 Forms

  • Form1
  • Form2 (with Label1)
  • Form3 (editing Label1 in Form2)

–> What it should happen:

  • Form1 creates and shows Form2
  • Form2 creates and shows Form3
  • Form3 make various operations (like creating a list,ordering it,..) and for each operation updates Label1 (and the user MUST see the update process) in Form2

All Form2 operations are invocated from a function called in the constructor of Form2 like:
Form2_Constructor() => calling makeOperations()
–> makeOperations() => calling Operation1(),then Operation2() and finally Operation3() where each OperationX() contains a cycle (let’s say of 30 iterations) doing some operation and calling Form2.setLabel1(“Operation Name”);

My idea (as title says) is to make two different threads..
.. or at least find a way to have two forms running in “parallel mode”(this way Form2 doesn’t idle when Form3 is executing operations).

Any idea how to solve this matter?

  • 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-30T12:24:02+00:00Added an answer on May 30, 2026 at 12:24 pm

    If you really wanted two different forms running on separate threads then you will need to create another thread which runs a message loop via Application.Run. However, this approach is not advised. It can cause weird problems and it makes it inconvenient for the two different forms to access each other since all accesses from one to the other require marshaling using Control.Invoke.

    I advise sticking with a single UI thread. Get as much of the long running code currently executed by Form3 into a worker thread. As the worker thread makes progress you can slowly publish the results to Form3. Publishing the results to Form3 can be done in one of two ways.

    • Have the worker thread push results to Form3 by calling Invoke or BeginInvoke
    • Have Form3 poll a shared data structure for results published by the worker thread

    Those that monitor my answers already know which one I am going to recommend: the later method in which the UI thread polls for the results. It has the following advantages.

    • It breaks the tight coupling between the UI and worker threads that Control.Invoke imposes.
    • It puts the responsibility of updating the UI on the UI thread where it should belong anyway.
    • The UI thread gets to dictate when and how often the update should take place.
    • There is no risk of the UI message pump being overrun as would be the case with the marshaling techniques initiated by the worker thread.
    • The worker thread does not have to wait for an acknowledgement that the update was performed before proceeding with its next steps (ie. you get more throughput on both the UI and worker threads).

    If the work currently being performed by Form3 cannot be easily moved to a worker thread (perhaps it is manipulating UI controls most of the time which can only done from the UI thread hosting the form) then you will need to slow down the rate at which this work is performed to allow more time for the form to respond to user input. This means you will be forced to make some sacrifices. For example, instead of filling a grid with thousands of rows you may need to fill it with only a hundred at a time and provide some kind of paging behavior that allow the user to move to the next hundred.

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

Sidebar

Related Questions

I have XML in the following form that I want to parse with PHP
i have two text inputs like the following, i don't want to use <form>
Let's say I have a form field for Name. I want to display an
I have following classes. In instance of BE (let's say objBE) i want to
This sounds like a really basic question. Let's say I have the following Form
Let's say I have the following scenario: <form action=/something.php method=GET>Click me</div> <script type=text/javascript><!-- $('form').submit(function(e)
I have following xml and I want to fetch the value of node which
I have following LINQ statement and I want to rewrite it using extension methods.
I have following code and i want to pass additional parameter in JSON.getJSONfromURL() method
for example I have the following: I want to go through each div class

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.