views:

323

answers:

1

I have three forms similar to the one in the link. I want add a Total textbox to every form. The total will add the values that will be entered in the montant textbox. So the total will take the specific value of that texbox for all the entries that the user will have and add them. How I can do so???? Thanks http://i1006.photobucket.com/albums/af189/diaboloent/OneForm.jpg

A: 

Put all the textboxes where the user will enter a value inside a common container like a groupbox or panel control. Then use code like this to total up the values:

Dim sum As Integer = 0
For Each box As TextBox In MyContainer.Controls.OfType(Of TextBox)()
    sum += Integer.Parse(box.Text)
Next box
Total.Text = sum.ToString()
Joel Coehoorn