CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2014
    Posts
    6

    child form controls

    How to do the below work in C++ ?
    main form is: Form1.
    child forms are: home and createConf.
    Form1 is the Parent MDI.(Main Form/Window)
    I am viewing home.
    there is a button in home and it is: crtConfBtn
    When I click on that crtConfBtn, application should open the child form, createConf, in the Form1. At the same time, the child form, home should be hide or close.
    That is clicking crtConfBtn should replace createConf with home.
    In other words, home should be override by the createConf.
    Please anyone know how to do that?

    Edit: I am using Visual C++ for this project and used windows forms to create forms.
    Last edited by jrmkr; March 26th, 2014 at 09:27 AM.

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: child form controls

    Do you use Visual C++/MFC? Or some of the .net technologie like Windows Form, managed C++/CLI?
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2014
    Posts
    6

    Re: child form controls

    Sorry for the mistake, I am using visual c++ 2010. and i create this application using windows forms.

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: child form controls

    I don't really understand your description of your scenario, but as a general design guideline, have the MDI parent form do all the management of the child forms. If you want a child form to trigger an action that affects other child forms, do that by calling a method you wrote in your MDI parent form class, that then carries out the desired actions. You gain access to the MDI parent from the MDI child forms via their MdiParent property. As you're going to call custom methods of your class that are not part of the standard .NET Form class, you'll need to cast the value of the property to the type of your MDI parent class in order to do so (use safe_cast).

    It's not imposible to have your MDI child forms interact directly with each other, but that's likely to lead to a bad program design which may quickly become really hard to understand and maintain.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured