DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   adding up checkbox values (http://www.daniweb.com/forums/thread58948.html)

mike7510uk Oct 23rd, 2006 7:37 am
adding up checkbox values
 
i have a form that has several checkboxes. I want a label to display the total amount of all the checkboxes clicked.
for example:
cbo1 = 100
cbo 2 = 75

if the user clicks both then the label will display 175
also, if the user unclick a box it will deduct it from the total.

campkev Oct 24th, 2006 2:39 pm
Re: adding up checkbox values
 
do you want the changes to take place immediately? or after form is submitted?

ManicCW Oct 25th, 2006 3:01 am
Re: adding up checkbox values
 
Dim myResult as Integer = 0
For Each chk as CheckBox in myPanel.Controls
If chk.Checked = True Then
myResult += chk.Value
End If
Next


All times are GMT -4. The time now is 7:28 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC