Closed Thread
Results 1 to 6 of 6

Thread: Make Parent Form stop when Child Form is loaded

  1. #1
    trinhtin is offline Newbie
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Question Make Parent Form stop when Child Form is loaded

    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

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2009
    Location
    Santa Clarita, CA
    Posts
    2,111
    Blog Entries
    47
    Rep Power
    31

    Re: Make Parent Form stop when Child Form is loaded

    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!

  4. #3
    trinhtin is offline Newbie
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Re: Make Parent Form stop when Child Form is loaded

    Thank you very much!

    This solution is correct with my case.

    In C# , we have a function
    Form.ShowDialog() to do this thing.

  5. #4
    Join Date
    Jul 2009
    Location
    Santa Clarita, CA
    Posts
    2,111
    Blog Entries
    47
    Rep Power
    31

    Re: Make Parent Form stop when Child Form is loaded

    Okay, I was about to give a clarifying response.
    Wow I changed my sig!

  6. #5
    trinhtin is offline Newbie
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Re: Make Parent Form stop when Child Form is loaded

    Quote Originally Posted by ZekeDragon View Post
    Okay, I was about to give a clarifying response.
    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!

  7. #6
    crystallove is offline Newbie
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Re: Make Parent Form stop when Child Form is loaded

    i had a same problem.
    Now, it was resolved, thanks a lot.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Take a child from parent using XPath? (jsp)
    By toto_7 in forum Java Help
    Replies: 0
    Last Post: 03-20-2011, 10:28 AM
  2. Intermediate Parent Child communication using pipes
    By code2learn in forum Linux Tutorials, Guides and Tips
    Replies: 0
    Last Post: 01-01-2011, 08:45 AM
  3. C# calling parent functions from child form
    By NeedHelp in forum C# Programming
    Replies: 13
    Last Post: 06-23-2010, 07:06 AM
  4. How can I make a Transparent form?
    By kresh7 in forum Visual Basic Programming
    Replies: 8
    Last Post: 08-22-2008, 01:48 AM
  5. Replies: 1
    Last Post: 11-19-2007, 09:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts