Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,574 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,879 people online right now. Registration is fast and FREE... Join Now!




Counting Visible CheckBoxes

 
Reply to this topicStart new topic

Counting Visible CheckBoxes, How to?

cheree71
10 May, 2008 - 11:38 PM
Post #1

New D.I.C Head
*

Joined: 10 May, 2008
Posts: 1

Hi I have an assignment due on Tusday and I'm against the clock. I've read everything in my text book relating to this problem, I've looked online, MSNDNAA etc and have ended up here. I've been trying to count checkboxes that are visible and returning the integer count to a label and not having any real luck.
Dim chkChick As CheckBox
Dim intAdd As Integer = 0

For Each chkChick in gpbChookNames.Controls
If chkChick.Visible = True Then
intAdd = intAdd + 1
lblCurrentChickens.Text = CStr(intAdd)
End If
Next

At first it returns the correct amount of visible items, however if I use my delete button which sets the checked CheckBox visible value to false and try the button click event handler that holds the code above again, it returns a much lesser value.
For instance I have twelve check boxes visible. I click ACCEPT(top code). I get the number 11. I check a box and hit delete. I have 10 checkboxes visible. I hit ACCEPT again, however my tally is now 9.
I don't understand why that'd be happening. Anyone got a clue why?

Thanks in advance
Cheree

This post has been edited by cheree71: 10 May, 2008 - 11:40 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:04AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month