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?
Printable View
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?
keep the totals as public variables in the respective forms
GRAND_TOTAL = val(form1.totals) + val(form2.totals) + ...
Is this what u need?
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