Results 1 to 5 of 5

Thread: [RESOLVED] Data passing between mdi child forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    82

    Resolved [RESOLVED] Data passing between mdi child forms

    hi guys,

    i would really like an easy way to pass values between child forms. i've read a tutorial on the net and sad to say i couldnt understand it.

    i have 2 child forms namely child 1 and chid 2 under one parent form parent 1. i want child 1 to pass values to child 2 and vice versa.

    any suggestions?

    regards

  2. #2
    Addicted Member sweet_dreams's Avatar
    Join Date
    Apr 2005
    Location
    Poland, Lodz
    Posts
    189

    Re: Data passing between mdi child forms

    Hi,

    I suggest you should read this articles:
    http://www.devcity.net/Articles/94/1/multipleforms.aspx
    http://www.devcity.net/Articles/100/multipleforms2.aspx
    http://www.devcity.net/Articles/102/multipleforms3.aspx

    they cover a vast material about working with multiple forms.

    regards,
    sweet_dreams
    using VB 2010 .NET Framework 4.0; MS Office 2010; SQL Server 2008 R2 Express Edition | Remember to mark resolved threads and rate useful posts.

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

    Re: Data passing between mdi child forms

    Let's say that you and I have a mutual friend. We both know him but we don't know each other. I can't get in touch with you because I have no way specific path to get to you. I could give our mutual friend a message, who has both our phone numbers, and he could pass it on to you. Alternatively I could get your phone number from our mutual friend and then I could contact you directly.

    In the situation above we are the child forms and our mutual friend is the parent. Neither child form knows about the other, but each has a reference to its parent in its MdiParent property. The parent form has a reference to each child in its MdiChildren property and any other references that it may have kept when the child forms were created. Now, one child can access a member of the parent form, which can then access a member of the other child. Alternatively the parent could pass one child a reference to the other and then that child can access members of the other child directly.

    OOP is designed to mimic real life. In real life you cannot affect something if you have no way to "touch" it. In OOP, if you don't have a reference to an object then you can't access it's members.

    I suggest that you read the "Forms in VB.NET" tutorial in my signature and work through it slowly and carefully. If you don't understand that then you've got big problems because that's a pretty good tutorial.
    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
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: Data passing between mdi child forms

    Thats great explaination JM.Im going through that link properly this time if Ive missed out the mdi child part
    Godwin

    Help someone else with what someone helped you!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    82

    Re: Data passing between mdi child forms

    great tutorial! thanks guys. in fact it solved my problem right away.

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