CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: MDI Projects

  1. #1
    Join Date
    Oct 2001
    Location
    Rockford, IL
    Posts
    2

    MDI Projects

    In a multiple-form MDI project, how can you add "totals" of mathematical procedures from each child form together, so the grand total shows in the GRAND TOTAL label in another child form?






  2. #2
    Join Date
    Jun 2001
    Location
    Sri Lanka
    Posts
    272

    Re: MDI Projects

    keep the totals as public variables in the respective forms
    GRAND_TOTAL = val(form1.totals) + val(form2.totals) + ...
    Is this what u need?


    If u don't know how to Rate an answer, then Rate my answer to learn, If u know, then practice it

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: MDI Projects

    You could do somethign like this:

    Dim frm as Form
    Dim dTotal as Double
    on error resume next
    for Each frm In Forms
    dTotal = dTotal + CDbl(frm.txtTotal.Text)
    next frm

    ' or in case you only need forms of a specific type
    ' like when you create multiple instances of a form
    ' using: Dim somefrm as new frmChild
    Dim frm as Form
    for Each frm In Forms
    If TypeOf frm = frmChild
    dTotal = dTotal + CDbl(frm.txtTotal.Text)
    End If
    next frm




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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