Results 1 to 5 of 5

Thread: mdi child on top

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Resolved mdi child on top

    I have a mdi parent form and numerous mdi children.
    When the user clicks on a button on the parent form i need to be able to find the name of the child form which is currently on top.

    Any Ideas my Luverlies :-)

    TIA
    Last edited by venerable bede; Dec 13th, 2007 at 04:51 AM.

    Parksie

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: mdi child on top

    Well, you could iterate through the MdiChildren property of the parent form to find one currently in focus or you could use the MdiChildActivate event of the parent form to track it yourself.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: mdi child on top

    CSharp Code:
    1. private void button1_Click(object sender, EventArgs e)
    2. {
    3.     MessageBox.Show(this.ActiveMdiChild.Name);
    4. }
    That said, I'm guessing you actually want the Text of the child, not the Name.
    Last edited by jmcilhinney; Dec 13th, 2007 at 12:00 AM. Reason: Changed VB.NET code to C#
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: mdi child on top

    Quote Originally Posted by jmcilhinney
    CSharp Code:
    1. private void button1_Click(object sender, EventArgs e)
    2. {
    3.     MessageBox.Show(this.ActiveMdiChild.Name);
    4. }
    That said, I'm guessing you actually want the Text of the child, not the Name.
    Do'h, I didn't even notice that property. Thanks
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Resolved Re: mdi child on top

    duh....nor did I otherwise I wouldn't have asked the question :-).

    Thanks jmcilhinney.

    U r my code God.
    Last edited by venerable bede; Dec 13th, 2007 at 04:51 AM.

    Parksie

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