How to make Parent Form wait when Child Form is loaded. When Child Form close, the Parent Form will continue its task.
I have 2 forms : Form1.cs, ChildForm.cs
Form1.cs :
.......
button1.click (....){
1// ChildForm cf = new ChildForm();
2// cf.Visible(true);
3// cf.doProcess();
}
When i click Button1 on Form1, ChildForm will display. However, the main thread is not stop its running, the cf.doProcess() in line3 continuously run while i want it waiting for i input something on ChildForm.
Any idea for this. Thanks
I had problems with this due to me being on a Linux machine, but what I think you want is a "Modal" window. You have to call the window in code, as modal. I'm not sure how you'd do that in C#, since I don't program with C#, but look around for modal window functions, that should be the way to do it something like:
[highlight=C#]Childform cf = new ChildForm();
cf.ShowModal();[/highlight]
You then perform all necessary calculations inside the modal window, giving it any information it needs before you show it, since a modal window won't return control to the parent window until it's done.
Wow I changed my sig!
Thank you very much!
This solution is correct with my case.
In C# , we have a function
Form.ShowDialog() to do this thing.
Okay, I was about to give a clarifying response.![]()
Wow I changed my sig!
i'm really sr about my first reply. I haven't yet test your solution before replying. Now i tested it and this solution is correct with my case.
In C# , we have a function
Form.ShowDialog() to do this thing.
The main thread wait until i close ChildForm.
Thank you very much!
i had a same problem.
Now, it was resolved, thanks a lot.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks