Click to See Complete Forum and Search --> : MDI Projects


DebL
October 8th, 2001, 03:44 PM
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?

srinika
October 8th, 2001, 10:10 PM
keep the totals as public variables in the respective forms
GRAND_TOTAL = val(form1.totals) + val(form2.totals) + ...
Is this what u need?

Cakkie
October 9th, 2001, 01:29 AM
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
slisse@planetinternet.be

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