CheckBox Count

  • Thread starter Thread starter jtnpham
  • Start date Start date
J

jtnpham

In the .aspx file I have a check box list containing five items.
After clicking on a button I want to display in a label the number of
items the user checked. Can someone help me on what the code would
look like in the .aspx.vb file?

Thanks
 
Dim counter as Integer = 0

For i=0 to Check1.Items.Count - 1
If Check1.Items(i).Selected Then
counter += 1
End If
Next i

Label1.Text = counter.ToString()

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

********************************************
Think outside the box!
********************************************
 
Back
Top