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?