Results 1 to 5 of 5

Thread: [RESOLVED] Hiding all mdichild forms

  1. #1

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Resolved [RESOLVED] Hiding all mdichild forms

    This is something very simple i think using this MdiChildren.FindAll...but im not sure how to use it...please help me..


    Ok,heres what I want to do...I just want to find whatever mdichildren of the parentform is visible and hide them all.Please help me with that...Thank you so much if you could help me with using those functions under mdichildren to do what i asked,it would be nice...I tried it,but im not sure how to make them work.

    Even if its any other way you know,no problem..but this is what I want to do.
    Thanks
    Godwin

    Help someone else with what someone helped you!

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Hiding all mdichild forms

    Quote Originally Posted by uniquegodwin
    This is something very simple i think using this MdiChildren.FindAll...but im not sure how to use it...please help me..


    Ok,heres what I want to do...I just want to find whatever mdichildren of the parentform is visible and hide them all.Please help me with that...Thank you so much if you could help me with using those functions under mdichildren to do what i asked,it would be nice...I tried it,but im not sure how to make them work.

    Even if its any other way you know,no problem..but this is what I want to do.
    Thanks
    Hi Uniquegodwin,

    I found something for you in MSDN, see this link:

    http://msdn.microsoft.com/library/de...childforms.asp

    And I think you'll find more about that aswell.

    Hope it can help you in the good direction.

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Hiding all mdichild forms

    Quote Originally Posted by uniquegodwin
    This is something very simple i think using this MdiChildren.FindAll...but im not sure how to use it...please help me..


    Ok,heres what I want to do...I just want to find whatever mdichildren of the parentform is visible and hide them all.Please help me with that...Thank you so much if you could help me with using those functions under mdichildren to do what i asked,it would be nice...I tried it,but im not sure how to make them work.

    Even if its any other way you know,no problem..but this is what I want to do.
    Thanks
    Hi,

    Found more about MdiChildren.

    In this example, you create two forms: Form1 and Form2. You set the IsMdiContainer property of Form1 to true and make it the MdiParent of Form2. Next you create a button, button1, on each form. When the button on the parent form is clicked, the event handler displays the child form. When the button on the child form is clicked, the event handler displays the Name property of its parent form. Use the following two code segments to overwrite button1 event handlers in both forms. You can use the property
    Show and Hide on those Forms.


    ' The event handler on Form1.
    VB Code:
    1. Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.     ' Create an instance of Form2.
    3.     Dim f2 As New Form1()
    4.     ' Make this form the parent of f2.
    5.     f2.MdiParent = Me
    6.     ' Display the form.
    7.     f2.Show()
    8. End Sub 'button1_Click

    I think this is a better sulution for your problem.

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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

    Re: Hiding all mdichild forms

    A form's MdiChildren property is just an array of Form references, so to hide all MDI child forms it's as simple as:
    VB Code:
    1. For Each child As Form In Me.MdiChildren
    2.     child.Hide()
    3. Next child
    Because any type of form can be an MDI child each element is typed to Form. This means that if you wanted to access members of the specific type of a child form you'd have to test the type and then cast it, just like you need to cast items from an ArrayList because they are all Object references.
    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

  5. #5

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: Hiding all mdichild forms

    Never thought this way...its simple
    Thanks Jm
    Godwin

    Help someone else with what someone helped you!

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